Language References
Specifies whether a media resource will auto-start playing as soon as it can.
Inline |
<element autoplay...> |
Script |
object.autoplay = true | false |
The property is read/write with a default value of false.
The autoplay attribute is a boolean attribute, meaning its presence on an element represents true, and its absence represents false.
When present, the user agent will automatically begin playback of the media resource as soon as it can do so.
NOTE: Not all user agents support or allow autoplay. Some browsers, specifically Mozilla Firefox ( as of this writing ), allow autoplay only when muted.
Example of using the autoplay attribute with the <audio
> element.
<audio autoplay controls>
<source src="happy-day.mp3" type="audio/mpeg">
Sorry, your browser does not support the audio element.
</audio>
which would render on a Web page as follows:
Example of using the autoplay attribute with the <video
> element.
<video autoplay controls width=640 height=360>
<source src="praise.mp4" type="video/mp4">
Sorry, your browser does not support the video element.
</video>
which would render on a Web page as follows:
AUDIO VIDEO