user385729
user385729

Reputation: 1984

Video Tag of HTML5 (default image)

I am using video tag of HTML5 (http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_all). But before playing the video it shows the very first second of the video as the image; however, that image is solid black for my case; so I would like to know if I can have the default image (before hitting the play button) from somewhere of the middle of the video?

I hope my question is clear, if it is not clear please ask me what part is ambiguous and I will provide more clarification

Appreciate it in advance.

Upvotes: 7

Views: 12655

Answers (1)

DarkAjax
DarkAjax

Reputation: 16223

Assuming you have an image file with the part of the video you want yo show, you can use the poster attribute on the <video> tag, in your case it'd be:

<video width="320" height="240" poster="<default image url>" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Upvotes: 16

Related Questions