Before HTML5, the audio files could not be played on a web page without support of third party plug-ins like Adobe Flash Player, Apple QuickTime Player etc. But HTML5 defines a new element (<audio>) which provides native audio playback support in the browser. The audio tag specifies a way to embed an audio file within a web page.
Important point need to be remembered:
HTML5 audio element is supported by latest versions of all web browsers. Internet Explorer 8 or earlier versions of Internet Explorer do not support audio element.
There is an example of HTML5 audio element given below:
<audio controls="controls" loop="loop" autoplay="autoplay" preload="none"> <source src="song.mp3" type="audio/mpeg"> <source src="song.ogg" type="audio/ogg"> Your browser does not support the audio element. </audio>
The text written between <audio> and </audio> tags is displayed if the browser does not support audio element.
Presently three audio file formats are supported by HTML5 audio element.