Pr.Pg Next Pg

<AUDIO>..</AUDIO> tag tutorials

  • The <AUDIO> element is quite similar to the video element. The element should support common sound formats such as WAV files, The <AUDIO> tag is new in HTML5.

  • The <AUDIO> tag defines sound, such as music or other audio streams.

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

  • Any text inside the between <AUDIO> and </AUDIO> will be displayed in browsers that do not support the <AUDIO> tag.

  • The <AUDIO> tag is supported in all major browsers like Chrome, Firefox, Internet Explorer 9, Safari, Opera.

  • The below table shows the attributes of <AUDIO> tag:

 

Sr No

Attributes

Descriptions

1

ID

This attribute specify a unique id for an element in Document.

2

Autoplay

This attribute specify that the audio will start playing as soon as it is ready.

3

Controls

This attribute specify that audio controls should be displayed such as a play/pause button etc.

4

Loop

This attribute specify that the audio will start over again, every time it is finished.

5

Muted

This attribute specify that the audio output should be muted.

6

Preload

This attribute specify if and how the author thinks the audio should be loaded when the page loads.

7

Src

This attribute specify the URL of the audio file.

 

Syntax:

<body>

<audio>

<source attribute = value>

</audio>

</body>

 

Example: HTML program to demonstrate Audio element and it’s different mode

Output:
Pr.Pg border                                              Next Pg