User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1 ( .NET CLR 3.5.30729) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1 ( .NET CLR 3.5.30729) Ogg audio files loaded and played via API calls through the Audio object are silent in recent versions of Firefox including 3.6.6 and 4beta. The game demo in the above URL uses that for its sound FX. It used to sound OK in Firefox until 3.5 or so (not sure), and also in Chrome (dev version at least). [Or is this intentional because the API changed and applications are out of date?] Reproducible: Always Steps to Reproduce: 1. In the above URL, hit refresh server list and join a game 2. hit space to fire or up-arrow to move Alternatively, just try code like: au = new Audio("http://jfd.github.com/wpilot/sound/ship_thrust.ogg"); au.load(); au.play(); Actual Results: Silence Expected Results: Sound effects
Are all your Ogg files hosted on GitHub? GitHub is serving Oggs with the wrong Content-Type: $ curl -I http://jfd.github.com/wpilot/sound/ship_thrust.ogg HTTP/1.1 200 OK Server: nginx/0.7.61 Date: Sun, 18 Jul 2010 20:57:49 GMT Content-Type: application/octet-stream Content-Length: 12372 Last-Modified: Thu, 01 Jul 2010 07:46:43 GMT Connection: keep-alive Expires: Mon, 19 Jul 2010 20:57:49 GMT Cache-Control: max-age=86400 Accept-Ranges: bytes Ogg files need to be served with audio/ogg or application/ogg for them to play in an HTML audio element. Do the Oggs play if you host them on a webserver configured with the correct Content-Type? If not, do they play in your browser when loaded from disk?
So, that is it. I tried a server which serves audio/ogg and it works. Also locally. That game is not mine. I'll tell the author. What's strange is that it did work a few months ago in Firefox (3.5, 3.6.x, ... not sure which). Has that behavior changed recently? and, shouldn't it also check the extension, just in case? (Chrome seems to do that)
Ok, thanks. I think Chrome is doing content sniffing, we're debating whether to do that as well.