HTML5 audio does not work in Firefox

Works great in Chrome. Moreover, I use the ogg file so that there is no problem. I am running the latest version 9.0.1. HTML5 sound is assumed to be supported by both Chrome and Firefox.

<audio id="audio"> <source src="audio/Your_Hand_In_Mine.ogg" type="audio/ogg" /> <source src="audio/Your_Hand_In_Mine.mp3" type="audio/mpeg" /> Your browser does not support the audio element. </audio> 
+7
source share
4 answers

The solution is to correctly convert the ogg file to mp3 or vice versa. The encoding was wrong when I just renamed the .ogg file to mp3, stupid. For this, I used software called "Audacity" and "Switch."

0
source

Most servers (including those used by GoDaddy) do not by default support the corresponding MIME types for OGG files. In this case, you need to set the appropriate MIME types for OGG files if you want HTML5 audio players to work correctly in Firefox. So, for the Apache server, you need to add the following to your .htaccess file:

 AddType audio/ogg .oga AddType video/ogg .ogv AddType application/ogg .ogg 

Obviously, other browsers will guess the MIME type based on the file extension if the MIME type is not supported.

If you need more information about this, check out this page on the Mozilla Developer Network: https://developer.mozilla.org/en/Configuring_servers_for_Ogg_media

+8
source

http://support.mozilla.org/en-US/questions/758978 I found this useful in my case, as I had the correct mime types and still have no luck:

You cannot play MP3 files with this code in Firefox. See https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements

 <audio controls="controls"> <source src="http://www.kevinroseworld.com/Music/OkaVanga/OkaVanga/BajeLaCalle.mp3" type="audio/mpeg" /> Your browser does not support the audio element. </audio> 

You will need to use a regular element to play this song in Firefox. You can see them as an example:

 <object data="music.mp3" type="application/x-mplayer2" width="xxx" height="xxx"><param name="filename" value="music.mp3"></object> <embed type="application/x-mplayer2" src="file.mp3" height="xxx" width="xxx" > 
+4
source

try using some audio libraries to work with HTML5 audio files. Because libraries handle various html5 audio related issues. Some libraries provide automatic backups for flash audio if the browser does not support HTML5 audio. One of the best libraries out there is http://www.schillmania.com/projects/soundmanager2/

+2
source

All Articles