Correct way to stream .m3u audio source in xcode IOS app

I made an app using Decsoft App Builder (mainly android based) which supports cordova/IOS.

The app works perfect in android (plays in background) but in the translated IOS version, once audio starts it opens a black "Live Broadcast" screen on top of the first view of the app (which has contact info, play pause buttons, etc). If this screen could be backgrounded so people can still stop or play from the app itself, see the pictures, contact us etc that would be perfect. As for now you can only control the audio (play pause as the 15 seconds forward and backwards doesn't work for live stream). if you press X it stops the audio but goes to the actual app first page view again.


Here is the code in app.js that controls the play:

(i looked in build settings/config and seems there is no swift in my xcode. I was looking to test some swift 4 code i seen for streaming icecast m3u files).


Taken from app.js (check line 29 "http://45.x.x.x part

window.App.NewView1 = {};
window.App.NewView1.Scope = $scope;


$rootScope.MediaPlayer1.API.stop();


$rootScope.MediaPlayer1.Sources = [{sr/c: $sce.trustAsResourceUrl("http://45.x.x.x:8001/kzjm"), type: "audio/mpeg"}];


setTimeout(function(){$rootScope.MediaPlayer1.API.play();},1);


$rootScope.Textarea1.Value = "Switch Successful! Listening to KZJM 92.7 FM The People's Station!.";




MusicControls.create({
track       : 'KZJM LIVE', // optional, default : ''
artist      : '927', // optional, default : ''
album       : 'KZJM',     // optional, default: ''
cover       : 'icon.jpg', // optional, default : nothing
isPlaying   : true, // optional, default : true
dismissable : false, // optional, default : false
hasPrev   : false, // show previous button, optional, default: true
hasNext   : false, // show next button, optional, default: true
hasClose  : true, // show close button, optional, default: false
duration : 0, // optional, default: 0
elapsed : 0, // optional, default: 0
hasSkipForward : true, //optional, default: false. true value overrides hasNext.
hasSkipBackward : true, //optional, default: false. true value overrides hasPrev.
skipForwardInterval : 15, //optional. default: 0.
skipBackwardInterval : 15, //optional. default: 0.
hasScrubbing : false, //optional. default to false. Enable scrubbing from control center progress bar
ticker   : 'KZJM LIVE',
}, onSuccess, onError);


window.App.Debugger.log("Invalid syntax for var audio = new Audio(); at NewView1 Show event", "error", 0);


window.App.Debugger.log("Invalid syntax for audio.src = \x22http://45.34.6.204:8001/kzjm\x22; at NewView1 Show event", "error", 0);


window.App.Debugger.log("Invalid syntax for audio.loop() = true; at NewView1 Show event", "error", 0);


window.App.Debugger.log("Invalid syntax for audio.play(); at NewView1 Show event", "error", 0);


$rootScope.$apply();
});


$rootScope.MediaPlayer1.onCanPlay = function() {


};


$rootScope.MediaPlayer1.onReady = function(API) {
$rootScope.MediaPlayer1.API = API;


};

Accepted Reply

This thread can be closed. The fix was tapping into the original mediaplayer api library (in windows environment) , adding the "hide" variable, and i was even able to keep the type back to default video/mp4, as I originally thought changing to audio/mpeg may fix (but it didn't). It all translated over to xcode (as my environment makes .xcodeproj files in windows at build, that just have to be transferred to a mac as Apple doesn't support app loader or xcode in windows).


All the best.

Replies

This thread can be closed. The fix was tapping into the original mediaplayer api library (in windows environment) , adding the "hide" variable, and i was even able to keep the type back to default video/mp4, as I originally thought changing to audio/mpeg may fix (but it didn't). It all translated over to xcode (as my environment makes .xcodeproj files in windows at build, that just have to be transferred to a mac as Apple doesn't support app loader or xcode in windows).


All the best.