HTML5 <audio> does not work with Firefox, even if I use .ogg

I'm trying to put some music on my site, so I decided to use HTML5 ballast. I found out that I have to use .mp3 + .ogg if I want the player to work in most browsers. So I did this:

<audio controls=""> <source src="http://maxinthebox.fr/files/167d9a8aaf49fbf1bc226045c8f6920e.ogg"/> <source src="http://maxinthebox.fr/files/3d4fafe76fbbfd5cba1b5ec181a35b94.mp3"/> </audio> 

It works fine with Chrome or Safari, even if I only put .ogg or .mp3. But with Firefox, by no means! I tried to open only .ogg, but Firefox shows me a video player. I searched on the Internet, but I did not find a solution that works.

So, if you can help me solve my problem, it would be great!

Thank you in advance!

EDIT: the problem is not in Firefox, not from the .ogg file, but from me! I had a .aif file that I transcoded using VLC to create a .ogg file. And when he asks me if I want to transcode the audio, I checked the MP3 instead of Vorbis! But with your help, I realized my mistake! Thank you very much!

+4
source share
1 answer

Try specifying the type attribute:

 <source src="http://maxinthebox.fr/files/167d9a8aaf49fbf1bc226045c8f6920e.ogg" type="audio/ogg"/> 

Otherwise, this is a mime type problem with your web host, as a result of which the video player opens instead. See this answer .

EDIT : The ogg file itself may not be compatible with firefox. Check with some examples here to determine if this is a server problem or an ogg file problem.

https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements

+1
source

All Articles