Find out if and how the author thinks that the video should be loaded on page load:
var x = document.getElementById("myVideo").preload;
Click the button to return the value of the preload attribute of the video.
The preload attribute is not supported in IE.
<!DOCTYPE html> <html> <body> <video id="myVideo" width="100" height="100" controls preload="none"> <source src="video.mp4" type="video/mp4"> <source src="video.ogg" type="video/ogg"> Your browser does not support the video tag. </video>//www . j a v a 2 s. c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myVideo").preload; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The preload property sets or gets the value of the preload attribute of a video.
The preload attribute sets how the author thinks that the video should be loaded on page load.
The preload attribute is ignored if the autoplay attribute is present.
Property Values
Value | Description |
---|---|
auto | load the entire video on page load |
metadata | load only metadata on page load |
none | should NOT load the video on page load |
The preload attribute returns a String representing what data should be preloaded.
Possible return values are