Video preload
Attribute
Example
Check if the video starts loading once the page is loaded:
var x = document.getElementById("myVideo").preload;
none // The video should not be loaded when the page loads
Definition and Usage
The preload
attribute is used to set or return the value of the video preload
attribute.
The preload
attribute sets or returns whether the audio/video should be loaded immediately after the page loads.
Note: This attribute is ignored if the autoplay
attribute is set.
Note: The <video>
element is new in HTML5.
Browser Support
All major browsers support the preload
attribute.
Note: Internet Explorer does not support the preload
attribute.
Syntax
Return the preload
attribute:
Set the preload
attribute:
Attribute Values
Value | Description |
---|---|
auto | Indicates that the audio/video should start loading once the page loads. |
metadata | Indicates that only the metadata of the audio/video should be loaded after the page loads. |
none | Indicates that the audio/video should not be loaded after the page loads. |
Technical Details
| Return Value: | A string, representing the preload data. Possible return values are "auto", "metadata", or "none". | | --- | --- |
More Examples
Example
The following example demonstrates how to set different attributes:
document.getElementById("myVideo").preload = "none"; document.getElementById("myVideo").preload = "auto";
Related Pages
HTML Reference: HTML <video>
preload Attribute