Next: HTML5 – Play sound/music with <audio> tag @ 2
With HTML5, we can easily play audio file with the <audio> tag. Here is an example.
<html> <head></head> <body> <audio controls loop autoplay> <source src="music.ogg" type="audio/ogg" /> <source src="music.mp3" type="audio/mp3" /> Your browser does not support the audio element. </audio> </body> </html>
A control panel will be shown when the HTML is rendered.
Please note that you have to include both .ogg and .mp3 because .ogg works in Firefox, Opera and Chrome while .mp3 is for Internet Explorer and Safari.
3 thoughts on “HTML5 – Play sound/music with <audio> tag @ 1”