HTML DOM Video autoplay attribute
Examples
See if they are ready to start playing after the video:
var x = document.getElementById ( "myVideo") autoplay.;
x The output is: true
try it"
Definition and Usage
autoplay property sets or returns whether the audio and video playback starts after loading.
This property reflects the HTML <video> autoplay attribute.
When present, it specifies after the video once loaded video will begin playing automatically.
Note: The <video> element is new in HTML5.
Browser Support
All major browsers support autoplay attribute
Note: Internet Explorer 8 and earlier versions of IE do not support the <video> element.
grammar
Back autoplay attributes:
videoObject .autoplay
Set autoplay properties:
videoObject .autoplay = true | false
Property Value
value | description |
---|---|
true | false | It describes the play automatically after the page is loaded
|
technical details
return value: | Boolean value. If the video starts playing returns true, false otherwise |
---|---|
Defaults: | false |
More examples
Examples
Disable Autoplay, and reload the video:
var x = document.getElementById ( "myVideo");
x.autoplay = true;
x.load ();
x.autoplay = true;
x.load ();
try it"
Examples
The following example demonstrates how to create a <video> element and set autoplay properties:
var x = document.createElement ( "VIDEO");
try it"
Related Pages
HTML Reference Manual: HTML <Video> AutoPlay Properties
Video Object