How to preload the video when the page loads in HTML5 ?
The HTML <preload> attribute is used to specify the way the developer thinks the video should be loaded when the page loads.
Syntax
<video preload=""> </video>
There are 3 values for preload attribute auto, metadata and none.
Note: A empty string lead to default auto attribute value.
Example 1: The following example demonstrates the video element using none attribute value for the preload property.
HTML
<!DOCTYPE html> < html > < body > < center > < h1 style = "color:green;" >GeeksforGeeks</ h1 > < h3 >HTML preload Attribute</ h3 > < video width = "400" height = "200" controls preload = "none" > < source src = type = "video/mp4" > < source src = type = "video/ogg" > </ video > </ center > </ body > </ html > |
Output:

preload with none value
Example 2: The following example demonstrates the video element using auto attribute value.
HTML
<!DOCTYPE html> < html > < body > < center > < h1 style = "color:green;" >GeeksforGeeks</ h1 > < h3 >HTML preload Attribute</ h3 > < video width = "400" height = "200" controls preload = "auto" > < source src = type = "video/mp4" > < source src = type = "video/ogg" > </ video > </ center > </ body > </ html > |
Output:

preload with auto value
Please Login to comment...