phetsims / vibe

Library for handling audio for PhET simulations. Provides cross-platform support and enables usage of base64 audio embedded in an HTML document.
MIT License
3 stars 3 forks source link

Audio not playing on FireFox on some operating systems #5

Closed jbphet closed 9 years ago

jbphet commented 11 years ago

Testing of John Travoltage and BAA simulations reveal that there are some cases where audio is not playing on FireFox. Mac OS and Win XP have been found so far to have this problem. More info soon.

jonathanolson commented 11 years ago

Not playing on Firefox 24 with OS X 10.6.8

samreid commented 11 years ago

@krhensberry report from: https://github.com/phetsims/john-travoltage/issues/37

In Firefox/Mac, no sound is playing at all (I checked I wasn't muted)

Name: John Travoltage

URL: http://www.colorado.edu/physics/phet/dev/html/john-travoltage/1.0.0-rc.1/john-travoltage_en.html

Version: 1.0.0-rc.1

Features missing: flexbox, touch

Flags: pixelRatioScaling

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0

Language: en-US

Window: 1440x723

Pixel Ratio: 2/1

jbphet commented 11 years ago

The cause of this is that MP3 is not a supported format for Firefox on OSX. This is apparently because mp3 is 'patent encumbered', so Firefox supports it when it can be used through an OS module, and not when it doesn't. This is why it works on Windows and not on OSX.

More information here if needed: http://stackoverflow.com/questions/18130797/play-mp3-files-via-html5-on-firefox-mac-alternatives https://support.mozilla.org/en-US/questions/969921

jbphet commented 11 years ago

One possible solution is to have all audio files in both MP3 and Ogg Vorbis format. I've seen that in several examples for using the Web Audio API. The code then tests which format is supported and plays it.

jbphet commented 11 years ago

By the way, OSX+Chrome does work, probably because our code is using the Web Audio API in this case (because it is available).

jbphet commented 11 years ago

I tested Firefox 25 on OSX to see if the addition of Web Audio also added support for the MP3 file format. Alas, it does not appear to. I stepped through to code to verify that the Web Audio API is now being used in this version of FireFox, and it is, but audioContext.decodeAudioData throws an error. Looks like I'll need to move forward with ogg support.

The following Stack Overflow article says that Web Audio doesn't support anything that HTML5 audio doesn't support, so the Vibe Sound.js type will continue to use the same test to determine which formats are supported (at least for now). http://stackoverflow.com/questions/17396882/web-audio-check-supported-formats

jbphet commented 11 years ago

This should now be fixed, but requires that both .mp3 and .ogg versions for each sound are contained within the simulation's audio directory. Will close if everything looks good after a bit more verification.

pixelzoom commented 9 years ago

It's been 17 months since @jbphet wrote:

Will close if everything looks good after a bit more verification.

Closing.