PhoneGap - pause the music!

0 favourites
  • 1 posts
From the Asset Store
6 looping tracks to use in your games and projects. These tracks are in the style of the 1960s detective movie genre.
  • 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>;

    } </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!! 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.

  • Try Construct 3

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

    Try 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)