Computer >> Computer tutorials >  >> Programming >> HTML

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


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>