D
D
devopg2020-09-07 11:09:27
JavaScript
devopg, 2020-09-07 11:09:27

How to catch the moment when the video is ready to take a preview?

I'm trying to catch the moment when you can do a preview using js at the video tag.
Tried these events but getting a black image:

<video src="i.video" preload="metadata" canplay="createVideoThumb()" />
<video src="i.video" preload="metadata" loadeddata="createVideoThumb()" />
<video src="i.video" preload="metadata" loadedmetadata="createVideoThumb()" />

If in any case I add delay , then everything works as it should.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tim, 2020-09-07
@Tim-A-2020

You are not using the event video event
list correctly with an example:
https://developer.mozilla.org/en/docs/Web/Guide/Ev...
you can also use the attribute poster- Specifies the address of the image that will be displayed until the video is available or not available.
htmlbook.ru/html/video

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question