Back to list of all examples
Useful Stuff About:
Implementing HTML5 Audio
Purpose: How do you use HTML5 Audio to showcase music or any audio without the user having to install a plug-in on their computer in order for their browsers to head the audio? Use HTML5 Audio like this:
Error in loading audio.
Different browsers render the audio controller differently
If you want to create your own custom player, visit this page.
At less than 264px, the time and duration don't render
Internet Explorer rendering
At less than 273px, you just get the play/pause button
<audio controls autoplay id="myAudio"><!-- you can remove the autoplay if you don't want the music to auto start -->
<source src="../media/bgmusic.mp3" type="audio/mpeg">
Your browser does not support HTML5 Audio<!--this displays if neither of the above can be played-->
- The file name of the mp3 doesn't match the code in the <source ...> line. Solution: make sure the file names and the code match
- The mp3 file is a 0 kb file so there's actually no music. Solution: Recreate the mp3 file
- The path to the mp3 file in the code isn't going to the right place. Solution: check the file path on the <source ...> lines in the code