How to specify that the element is read-only in HTML?



In this article we are going to learn about how to specify if and how the authoe thinks the audio/video should be loaded when the page loads in HTML.

By using the HTML Audio Preload Attribute, the author can describe how they want the audio to load when the page does. This feature allows the author to tell the browser how to implement a website's user experience.

Note  The preload gets ignored when autoplay was present.

Syntax

Following is syntax for HTML preload attribute.

<video preload="auto|none">

For getting better understanding on how to specify if and how author thinks the audio/video should be loaded when the page loads in HTML.

<video>preload=” auto”

The preload=auto setting instructs the browser to download the whole video. The video is fully played again after starting with this method, which is the most data-intensive. The auto selection is used if the preload attribute isn't given a value.

Example

In the following example we are setting the preload=” auto”.

<!DOCTYPE html>
<html>
<body>
   <video width="320" height="240" controls preload="none">
      <source src="https://samplelib.com/lib/preview/mp4/sample-5s.mp4">
   </video>
</body>
</html>

On executing the above script, it will make the user reload the video that was uploaded with the image shown when the user tries to reload the webpage.

<video>preload =”none”

Preload=none instructs the browser to download 0 bytes of the video despite the fact that there is one present. There is no local video storage on the device, so this clearly saves data but comes at the expense of a delayed video startup.

Example

Considering the following example we are setting the preload=”none”.

<!DOCTYPE html>
<html>
<body>
   <video width="320" height="240" controls preload="none">
      <source src="https://samplelib.com/lib/preview/mp4/sample-5s.mp4" type="video/mp4">
   </video>
</body>
</html>

When the script gets executed, it makes the user not load the video when the webpage gets loaded


Advertisements