What is HTML5 Audio Tag

The audio elment is most exciting and long-awaited features in HTML5 to enable native audio playback within the browser.
  • 2330
HTML5 Audio Formats

In HTML5 there are 3 formats supported for the audio element:
  • Ogg Vorbis = This format will work in Firefox, Opera and Chrome only.
  • MP3 = MP3 audio file support Chrome and Safari.
  • Wav = The Wav format will work in Firefox, Opera and Safari.

Currently, the HTML5 defines five attributes for the audio element:
  • Autoplay =  A boolean specifying whether the file should play as soon as it can ready.
  • Controls =  Specifying whether the browser should display its default media controls.
  • Loop =  It specifying whether the file should be repeatedly played.     
  • Preload = Specifies that the audio will be loaded at page load, and ready to run. If  autoplay is present just ignore it
  • Src =  a valid <abbr>URL</abbr> specifying the content source.

As video element work in HTML5, if you want to play an audio file simply add control attribute for adding play, pause, and volume controls. 


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.

Internet Explorer 8 does not support the audio element also. In IE 9, there will be support for audio element. 

Although HTML5 audio is a relatively immature part of the standard, if recent trends continue and users upgrade to the latest versions of Safari, Firefox, Chrome and Opera, browser support is likely above 30% today.


In this article, I discussed Audio tag in HTML5. 

Further Readings

You may also want to read these related articles.

Ask Your Question 

Got a programming related question? You may want to post your question here

© 2020 DotNetHeaven. All rights reserved.