Open In App
Related Articles

How to preload the video when the page loads in HTML5 ?

Improve Article
Improve
Save Article
Save
Like Article
Like

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


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 25 Mar, 2021
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials