HTML5 audio autoplay, Use of autoplay attribute in audio tag.


 

HTML5 audio autoplay, Use of autoplay attribute in audio tag.

you will see the use of autoplay attribute of audio tag.

you will see the use of autoplay attribute of audio tag.

HTML5 audio autoplay, Use of autoplay attribute in audio tag.

Introduction:

The autoplay is an audio tag attribute. It is only supported by HTML5. When it is present in audio tag, the music file will begin itself.
or
After loading web page, music will start automatically .

autoplay attribute:
Attribute Value Description
autoplay Boolean If it is presented in audio tag. Music will start itself.

Declaration Syntax :

Declaration syntax of autoplay attribute  in HTML5.

                       <audio src="URL" autoplay controls>Content</audio>

Example of <audio> in HTML5:

Code:
AudioAutoplay.html
<!DOCTYPE html >
<html >
<head>
<title>Audio Tag </title>
</head>
<body>
<p><b>Example of audio tag in HTML5.</b></p>
<audio autoplay controls>
<source src="a1.mp3" type="audio/mp3" />
Browser does not support audio tag.
</audio>
</body>
</html>
Output:

Download this code

Difference Between HTML5 and HTML4.01:

The audio tag  is only available in HTML5. It is not available in HTML4.01.

Ads