check if audio is playing

how I can check if audio is playing?

Example: = wade.playAudio('music.ogg', true);
// I need to know if this variable playing:

Because if its not playing and I try to stop it with iPad or iPhone:
--> program/game will crash!
It works fine with Android and PC (without check if playing first), but iPhone need to audio playing first if try to stop it.

1 Comment

Hi Janne

Thanks for bringing this to my attention, I had no idea that that would cause a crash on iPhone and iPad. I will add a fix for the next release.

In the meantime I have a workaround for you. Not ideal, but it should work for the time being. When you call wade.playAudio, you can pass it a callback:

wade.playAudio(file, looping, callback)

The callback is called when the sound is finished playing. So you can keep track of your music state (whether it's playing or not), by doing something like this: = true; = wade.playAudio('music.ogg', false, function() { = false;

// and some time later...

if ( {

I hope that helps

Post a reply
Add Attachment
Submit Reply
Login to Reply