I'm developing an app with angularJS and Cordova
Now I'm using the Media Plugin for play different audios
I detected and issue on iOs when I'm playing a background audio (long audio and looped) and another audio(short and plays only one time), when the second audio is finished, then my background audio also stops
any idea how to fix?
piece of code
backgroundMusic = new Media("background",
function () {
//success (object has completed the current play, record, or stop)
},
function (err) {
//error
console.log("playAudio():Audio Error: " + err);
},
function (status) {
if(status == Media.MEDIA_STOPPED){
//patch for ios issue
backgroundMusic.seekTo(1);
backgroundMusic._position = 0;
//end of patch
backgroundMusic.play({playAudioWhenScreenIsLocked : false});
}
}
);
backgroundMusic.play({playAudioWhenScreenIsLocked : false});
//and the other audio
openPopUp = new Media("openPopUp.mp3",
function () {
//success (object has completed the current play, record, or stop)
},
function (err) {
//error
console.log("playAudio():Audio Error: " + err);
}
);
openPopUp.play({playAudioWhenScreenIsLocked : false});
When the openPopUp audio is finished, then the background audio ends too