Saturday, 15 March 2014

cordova - How can I pause audio when an Android app is suspended - Edge Animate and PhoneGap Build -


I have an app made in angle animated and packed with phonegap build.

The app works fine but when I use the Home or Back button on the Android device to exit the app, the audio continues to play, even if the app itself seems to be suspended It goes in the background and is not the case for the iOS version.

Is there any way to mute or block my audio on those buttons?

I have tried to use;

  Documents. AddEventListener ("Pause", Pause, Pause, Incorrect); Document.addEventListener ("Resume", on resum, incorrect); Function on paus () {my_MUSIC.pause (); }; Function Honorsum () {my_MUSIC.play (); };     

; Priority name = "Maintenance" value = "wrong" />

is still running in my config.xml.

I have participated in ideas and no answers can be found on the internet.

Thank you for your help

I have to do this work ... < / P>

  function loopMUSIC (url) {// url my_MUSIC = new Media (url, // success callback function () {}, // error callback function (err) {}, // loop audio Play audio file on function status) {if (position === Media.MEDIA_STOPPED) {my_MUSIC.play ();}}); My_MUSIC.play (); Function on paus () {my_MUSIC.pause (); } Document.addEventListener ("Stop", On Pause, False); Function Honorsum () {my_MUSIC.play (); } Document.addEventListener ("Resume", Honor, False); }  

No comments:

Post a Comment