HTML Audio/Video DOMautoplayProperty

HTML Audio/Video DOM Reference Manual

Example

Enable autoplay and reload the video:

myVid=document.getElementById("video1");
myVid.autoplay=true;
myVid.load();

Try it Yourself »

Definition and Usage

The autoplay property sets or returns whether audio/video should start playing immediately after loading.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autoplay property.

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


Syntax

Set the autoplay attribute:

audio|video.autoplay=true|false

Return the autoplay attribute:

audio|video.autoplay

Property value

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

Technical Details

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


HTML Audio/Video DOM Reference Manualother extensions