0 Favourites

PhoneGap - pause the music!

  • Hi All,

    Now that the audio is working in the PhoneGap export (yay!), I'm trying to get my looping background music to pause when the Android app is minimised/backgrounded. Anyone know how to do this?

    I think it's something I need to put in the following code in the index.html to mute or pause the music file.

    <font color=green>document.addEventListener("pause", onPause, false); </font>

    <font color=green>function onPause(){ }</font>

    As an interim measure I have used:

    <font color=green>document.addEventListener("pause", onPause, false);</font>

    <font color=green>function onPause(){ </font>

    <font color=red>navigator.app.exitApp();

    } </font>

    to completely kill the app (and hence the audio), but it isn't an elegant solution. Any help or suggestions gratefully appreciated, I've been working on this for a few days and can't find any assistance online either.

    Many, many thanks!!

    ...an alternative would be to put the entire app into a paused state (including the music) - which would actually be an even better result!

    I've asked on the PhoneGap Build forum too.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)