How to specify if and how the author thinks the audio/video should be loaded when the page loads in HTML?


You can try to run the following code to learn how to implement a preload attribute to allow the author to give a hint to the browser for the best user experience. Works for both <audio> and <video> tags −

Example

<!DOCTYPE HTML>
<html>
   <body>
      <video width="300" height = "200" preload = "none" controls>
         <source src = "/html5/foo.ogg" type = "video/ogg" />
         <source src = "/html5/foo.mp4" type = "video/mp4" />
         Your browser does not support the video element.
      </video>
   </body>
</html>

Updated on: 24-Jun-2020

66 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements