Child

HTML5 Audio Elements



Before the development of HTML5 and its <audio> element We are using the embed or different browser plugins for play our audio file. But with the development of HTML5 now we can use the <audio> element. The <audio> element give you some more features, that you can full manage or control your browser media player.

Browser Support: Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the <audio> element.

output Example for Audio Element




Here is the code for Audio Element

<audio controls>
  <source src="whistle.ogg" type="audio/ogg">
  <source src="whistle.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

Audio Formats and Browser Support

Currently, there are 3 supported file formats for the <audio> element: MP3, Wav, and Ogg:

Browser MP3 Wav Ogg
Internet Explorer 9+ YES NO NO
Chrome 6+ YES YES YES
Firefox 3.6+ NO YES YES
Safari 5+ YES YES NO
Opera 10+ NO YES YES


MIME Types for Audio Formats

Format MIME-type
MP3 audio/mpeg
Ogg audio/ogg
Wav audio/wav


HTML5 Audio Tags

Tag Description
<audio> Defines sound content
<source> Defines multiple media resources for media elements, such as <video> and <audio>