PhoneGap - pause the music!

Get help using Construct 2

Post » Tue Mar 20, 2012 9:51 pm

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.

document.addEventListener("pause", onPause, false);
function onPause(){ }


As an interim measure I have used:

document.addEventListener("pause", onPause, false);
function onPause(){
navigator.app.exitApp();
}


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. AndyWatson2012-03-20 21:55:05
B
31
S
11
G
7
Posts: 197
Reputation: 6,682

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests