How do we set an image to be shown while the video is downloading in HTML?

HTMLWeb DevelopmentFront End Technology

Use the poster attribute in HTML to set an image to be shown while the video is downloading.

Example

You can try to run the following code to implement poster attribute −

<!DOCTYPE HTML>
<html>
   <body>
      <video width = "300" height = "200" poster = "https://www.tutorialspoint.com/images/logo.png" 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>
raja
Published on 14-Mar-2018 14:40:00
Advertisements