Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML Audio/Video DOM autoplay Property

HTML Audio/Video DOM autoplay Property

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Enable autoplay and reload the video:

myVid=document.getElementById("video1");

myVid.autoplay=true;

myVid.load();

Try it »


Definition and Usage

The autoplay property sets or returns whether the audio/video should start playing immediately after it is loaded.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autoplay attribute.

**Note:** Internet Explorer 8 and earlier versions do not support this property.


Syntax

Set the autoplay attribute:

audio|video

.autoplay=true|false

Returns the autoplay attribute:

audio|video

.autoplay

Attribute values

Value Description
true Indicates that the audio/video should start playing immediately after loading.
false Default. Indicates that the audio/video should not start playing immediately after loading.

Technical Details

Return Value: Boolean value, true|false
Default value: false

HTML audio/video Tag Reference HTML Audio/Video DOM Reference