isMusicPlaying() fails on Firefox

isMusicPlaying() fails on Firefox
0.0 0



I am trying to finalize some music in a game and get consistent playback across browsers. I am seeing inconsistency. I originally used playMusic and stopMusic, but it seemed like on IE, once music was stopped, it would not reload.

So I switched over to testing whether music was already playing, and just pausing it. This works well on many browsers, but it seems like Firefox ignores cc.AudioEngine.getInstance().isMusicPlaying(), so it never pauses.

Please see this link and look at the console log - you can see that the test fails on Firefox, yet you can hear the music is indeed playing:

Please let me know if anyone has a recommendation here.

Thank you,




Well, as a temporary workaround you could just “trust” that your button will hold the correct state and make it call either playMusic or stopMusic as required.

I tried looking at your Gametitle.js but your toggling logic confused me a bit, so I can’t really comment on that. BUT: if you are truly sure that it works in other browsers but fails on firefox then you should request a bug fix in the issue tracker ( ).

BTW: maybe you should try using the latest version of cocos2d-html5 from github ( ), I’ve just checked and there’ve been some changes ( ) since v2.2.2 came out, so maybe it’s already fixed in there? If it’s not, then you should definately create an issue!


Hi Zippolag,

Thanks for jumping in. I did start by using playMusic and stopMusic, but I found that once you stop the music on IE it would not restart. So I was trying to keep the sound loaded and test if it was indeed playing. But that fails on Firefox. I am currently using setVolume to turn the music off and then back on. Not ideal but has the most consistent support on major browsers.

I am using the latest develop version of 2.2.2 already.

Sounds like I should create an issue then!

Thanks again for the ideas.



At your service. Too bad I couldn’t offer much help 'tho.