Video preloadProperty

Video 对象参考手册Video Object

Example

Check whether the video starts loading as soon as the page loads:

var x = document.getElementById("myVideo").preload;
xThe result is:
none // The video should not be loaded when the page loads

Try it yourself »

Definition and Usage

The preload property is used to set or return the value of the video's preload attribute.

The preload property sets or returns whether the audio/video should be loaded immediately after the page loads.

Note:If the autoplay attribute is set, this attribute is ignored.

Note:The <video> element is new in HTML5.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the preload attribute.

Note:Internet Explorer does not support the preload attribute.


Syntax

Return the preload property:

videoObject.preload

Set the preload property:

videoObject.preload="auto|metadata|none"

Property Values

Value Description
auto Indicates that the audio/video should start loading as soon as the page loads.
metadata Indicates that only the metadata of the audio/video should be loaded when 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 preloaded data. Possible return values are "auto", "metadata", or "none".


More Examples

Example

The following example demonstrates how to set different properties:

document.getElementById("myVideo").preload="none";
document.getElementById("myVideo").preload="auto";

Try it yourself »


Related Pages

HTML Reference Manual:HTML <video> preload Attribute


Video 对象参考手册Video Object Other Extensions