Share on Google+Share on Google+

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

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

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


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.
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:

<!DOCTYPE html >
<html >
<title>Audio Tag </title>
<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.

Download this code

Difference Between HTML5 and HTML4.01:

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



Posted on: September 3, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null