LDG

Firefox Audio canplay bugs

by Matt Hackett, 2012 Jul 13
How to Make a Video Game All By Yourself

We're getting geared up to launch our new game Lunch Bug, so we've (finally) been testing the game more thoroughly in browsers other than Google Chrome. In the process, it looks like I may have found a few audio bugs in Firefox.

There seem to be two bugs. The first bug is that Firefox throws the canplay and canplaythrough events twice when an audio file loads (they should only be thrown once). I could only reproduce this on Mac OS X.

Second, Firefox appears to fire the canplay and canplaythrough events when an audio instance's currentTime property is set. This is unexpected behavior and doesn't happen in other browsers. When talking with Geoff, it came up that there could be a case where this behavior might make sense: for example if currentTime was set to a value past what has loaded so far, perhaps currentTime could tell listeners that it cannot play.

However this behavior doesn't seem intentional, as it doesn't happen in other browsers and isn't mentioned (at least to my knowledge) in the W3C specification.

Show me the demonstration!

The ridiculously large button above links to the demo where you can try out the bugs for yourself, and I put the source code on GitHub.

By taking the time to create a concise demonstration, my hope is to make it easier for other developers to either help me figure out the confusion on my end, or if these are indeed bugs in Firefox, to ease the process of getting those fixed. On that note I've created two tickets using Mozilla's bug tracker:

What do you think? Was the demonstration easy to follow? Do these bugs look legitimate? If so, do you know any Mozilla engineers?

Follow author @richtaur

LDG © 2022 • BlogTerms of ServiceVideo Policy • v2.1.2