Reputation: 36753
Here is the HTML:
<audio controls="controls" tabindex="0">
<source type="audio/ogg" src="/Public/audio/ding.ogg"></source>
<source type="audio/mp3" src="/Public/audio/ding.mp3"></source>
Your browser does not support the audio element.
</audio>
The player displays just fine in the latest version of Chrome (18).
Whereas in Firefox 12, the player flashes on initial page load and just fades out.
Here's are the error messages I see when inspecting via Firebug:
HTTP "Content-Type" of "application/octet-stream" is not supported. Load of media >resource http://localhost:18214/Public/audio/ding.ogg failed.
Specified "type" of "audio/mp3" is not supported. Load of media resource /Public/audio/ding.mp3 failed.
All candidate resources failed to load. Media load paused.
How can I play an audio file in Firefox 12?
Upvotes: 4
Views: 8837
Reputation: 318578
Ensure that your server sends the proper content type for the .ogg file. According to the error your server sent application/octet-stream
while it should be application/ogg
(or maybe audio/ogg
).
Since you are using ASP.MVC3 with IIS7, don't forget to add the MIME type for .ogg files. http://technet.microsoft.com/en-us/library/cc725608%28v=ws.10%29.aspx
application/ogg
After you add that MIME type, IIS will serve your .ogg files correctly and the player will work.
Upvotes: 5