Learn audio tags in HTML

The audio tags is used to specify sounds such as music and other audio clips. Currently three file formats for audio tags in  HTML5 are supported.

  1. mp3
  2. wav
  3. ogg

HTML5 supports <video> and <audio> controls. Flash, Silverlight and similar technologies are used to play multimedia elements.

The table below specifies which web browser supports which audio file format.

mp3 wav ogg Browser name
Yes No No ie browser Internet Explorer
Yes Yes Yes chrome browser Google Chrome
Yes Yes Yes firefox browser Mozilla Firefox
No Yes Yes opera browser Opera
Yes Yes No safari browser Apple Safari

Example for HTML audio tag

In the following code, we see the 3mp file playback using the HTML audio tag.

<audio  controls >

  <source  src = ”koyal.mp3 ″ type =” audio / mpeg ” >

Your browser does not support the html audio tag.



In the following code, you can see the ogg file playback using the HTML audio tag.

<audio  controls >

  <source  src = ”koyal.ogg” type = ”audio / ogg” >

Your browser does not support the html audio tag.


Backup browsers

Element name chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
<audio> Yes Yes Yes Yes Yes

Audio tag features in HTML

The following table lists the features or attributes of the audio tag in HTML.

Description Feature name
Defines audio controls that are displayed with the play / stop buttons. controls
Specifies that the audio file start playing as soon as it is ready. autoplay
Specifies that it resumes playback each time the audio file is finished. loop
Used to mute the output sound. muted
Specifies the author’s opinion for uploading the audio file when loading the page. preload
The URL specifies the source of the audio file. src

Example of Audio tag features

Here we use the attributes controls, autoplay, loop and src in the audio tag.

<audio  controls autoplay loop >

  <source  src = ”koyal.mp3 ″ type =” audio / mpeg ” > </audio>

MIME types for audio format in HTML

The available MIME type for the audio tag is given in the table below.

MIME type Audio format
audio / mpeg mp3
audio / ogg ogg
audio / wav wav

Leave a Reply

Your email address will not be published. Required fields are marked *