I'd like to chose a specific time that the tag uses (instead of the first frame - which is always black in my case) for the "preview".
I've currently made thousands of "poster" files, but this is clunky and inflexible.
Is this possible?
I'd like to chose a specific time that the tag uses (instead of the first frame - which is always black in my case) for the "preview".
I've currently made thousands of "poster" files, but this is clunky and inflexible.
Is this possible?
What you want to do is use an image (screenshot) from the video to be set as the placeholder. The advantage of this is loading time, its much faster to load a little .PNG file instead of preloading the video to show that frame.
This appears to have been discussed before:
That link may not be specific enough, you want to use the "poster" attribute in the "video" tag.
<video poster="image.png">
<source src="video.mp4" />
</video>
There is no immediate way to accomplish what you want.
If you do not specify a poster as per specification the browser should display the first frame of the video upon first presentation of the video tag.
When the video element is paused, the current playback position is the first frame of video, and the element's show poster flag is set The video element represents its poster frame, if any, or else the first frame of the video.
You could think about capturing a specific frame through a canvas element. This question can give you some hints on how to do that.
If you want a full-fledged thumbnail selection process, you will need to use a software like ffmpeg (server side) to generate thumbnails at different timestamps of the video and allow for a user to select one (or generate one at a given timestamp). This can help you.
Also keep in mind that a good poster can generate more views for your video (people tend to click/touch more video element with attractive posters). So spending some time on generating good posters is usually time well spent.
As it turns out, I can do this with:
video.currentTime = 10
where 10 is the seconds into the video that I want to show. Only tested in Chrome....
I understand, I know its a pain to create the "posters" but I think in the end its the most efficient way to achieve the effect...