Video preload Property
Example
Find out if and how the author thinks that the video should be loaded when the page loads:
var x = document.getElementById("myVideo").preload;
Try it Yourself »
Description
The preload property sets or returns the value of the preload attribute of a video.
The preload attribute specifies if and how the author thinks that the video should be loaded when the page loads.
The preload attribute allows the author to provide a hint to the browser about what he/she thinks will lead to the best user experience. This attribute may be ignored in some instances.
Note: The preload attribute is ignored if the autoplay attribute is present.
Browser Support
Property | |||||
---|---|---|---|---|---|
preload | Yes | 9.0 | Yes | Yes | Yes |
Syntax
Return the preload property:
videoObject.preload
Set the preload property:
videoObject.preload = "auto|metadata|none"
Property Values
Value | Description |
---|---|
auto | The author thinks that the browser should load the entire video when the page loads |
metadata | The author thinks that the browser should load only metadata when the page loads |
none | The author thinks that the browser should NOT load the video when the page loads |
Technical Details
Return Value: | A String, representing what data should be preloaded (if any). Possible return values are "auto", "metadata", or "none". See "Property Values" for what the values mean |
---|
More Examples
Example
A demonstration of how to set different property values:
document.getElementById("myVideo").preload = "none";
document.getElementById("myVideo").preload = "auto";
Try it Yourself »
Related Pages
HTML reference: HTML <video> preload attribute
❮ Video Object