Audio element is the one of the best powerful weapons of Html5. Before the audio elements of Html5, we were unable to play an audio file without using the third party browsers plug-in as flash player or Quicktime. Now, it support full user control for playing the audio file in the browser without installing a browser plug-in.
Html5 supports <audio> tag which is used to embed sound content in an HTML or XHTML document. The current Html5 does not specify which audio formats browsers should support in the audio tag. But most commonly used audio formats are ogg, mp3 and wav. <source> tag use to specify media along with media type. An audio element allows multiple source elements and browser will use the first recognized format.
|autoplay||Specifies whether the audio will play automatically or not.|
|autobuffer||Specifies whether the audio will automatically begin buffering even if it's not set to automatically play.|
|controls||Specifies audio including volume, seeking, and pause/resume control options.|
|loop||Specifies whether the audio start after reaching at the end in loop.|
|preload||Specifies that the audio will be loaded at page load, and ready to run.|
|src||Specifies URL of the audio.|
<audio controls autoplay> <source src="music.mp3" type="audio/mpeg" /> <source src="music.ogg" type="audio/ogg" /> <source src="music.wav" type="audio/wav" /> Your browser does not support the <audio> element. </audio>