HTML Audio/Video DOM autoplay attribute
Example
Enable autoplay and reload the video:
myVid=document.getElementById("video1"); myVid.autoplay=true; myVid.load();
Definition and Usage
The autoplay attribute sets or returns whether audio and video should start playing immediately after loading.
Browser Support
All major browsers support the autoplay attribute.
Note:Internet Explorer 8 or earlier browsers do not support this attribute.
Syntax
Set autoplay attribute:
audio|video.autoplay=true|false
Return autoplay attribute:
audio|video.autoplay
Attribute value
Value | Description |
---|---|
true | Indicates that audio and video should be played immediately after loading. |
false | Default. Indicates that audio and video should not be played immediately after loading. |
Technical Details
Return value | Boolean value. true|false |
---|---|
Default value: | false |