HTML <video> autoplay Attribute
Example
<video width="340" height="260" controls autoplay>
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
Your browser does not support the video tag.
</video>
Meaning
The autoplay attribute specifies the browser should begin playing a video after page load once enough content has been received and it is reasonable to play without interruptions.
Note: In some browsers (e.g. Chrome 70.0) autoplay doesn't work if no muted attribute is present.
Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible.
If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it).
Standard Syntax
HTML: <video autoplay>...</video>
XHTML: <video autoplay="autoplay">...</video>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| autoplay | This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. |