HTML DOM Video autoplay Property
-- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
JavaScript Reference
JavaScript Objects
JavaScript Array Object JavaScript Boolean Object JavaScript Date Object JavaScript Math Object JavaScript Number Object JavaScript String Object JavaScript RegExp Object JavaScript Global Properties/Functions JavaScript Operators JavaScript Error
Browser Objects
Window Object Navigator Object Screen Object History Object Location Object Storage Object
DOM Objects
HTML DOM Document Object HTML DOM Element Object HTML DOM Attribute Object HTML DOM Event Object HTML DOM Console Object CSSStyleDeclaration Object DOM HTMLCollection
HTML Objects
<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset > <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>
HTML DOM Video buffered Property
Deep Dive
Computer Science
Web Services
Development Tools
Scripts
Software
Web Service
Scripting Language
Programming
Web Design and Development
Programming Language
Video autoplay Property
Example
Check if the video starts playing as soon as it is ready:
var x = document.getElementById("myVideo").autoplay;
The output of x will be:
true
Definition and Usage
The autoplay property sets or returns whether an audio/video should start playing as soon as it is loaded.
This property reflects the HTML <video> autoplay attribute.
When present, it specifies that the video will automatically start playing as soon as it is loaded.
Note: The <video> element is new in HTML5.
Browser Support
The autoplay property is supported by all major browsers.
Note: Internet Explorer 8 and earlier versions do not support the <video> element.
Syntax
Return the autoplay property:
videoObject.autoplay
Set the autoplay property:
videoObject.autoplay=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Specifies whether the audio/video should automatically start playing as soon as it is loaded. * true - Indicates that the audio/video will start playing as soon as it is loaded. * false - Default. Indicates that the audio/video should not start playing as soon as it is loaded. |
Technical Details
| Return Value: | A Boolean. Returns true if the video starts playing, otherwise false. |
|---|---|
| Default Value: | false |
More Examples
Example
Disable autoplay and reload the video:
var x = document.getElementById("myVideo");
x.autoplay = true;
x.load();
Example
The following example demonstrates how to create a <video> element and set the autoplay property:
var x = document.createElement("VIDEO");
Related Pages
HTML Reference: HTML <video> autoplay Attribute
YouTip