Latest web development tutorials

HTML Audio / Video DOM autoplay attribute

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

Examples

AutoPlay is enabled, and reload the video:

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

try it"

Definition and Usage

autoplay property sets or returns the audio / video whether loaded immediately starts playing.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support autoplay attribute.

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


grammar

Set autoplay properties:

audio|video .autoplay=true|false

Back autoplay attributes:

audio|video .autoplay

Property Value

描述
true 指示音频/视频应在加载后立即开始播放。
false 默认。指示音频/视频不应在加载后立即开始播放。

technical details

返回值: 布尔值,true|false
默认值: false


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