Skip to content
Advertisement

Video is not drawn on canvas when autoplay is false on Chromium

The following code works fine on Firefox whether autoplay is true or false but not on Chromium. How can I fix it?

EDIT 1: I found out that I can begin with autoplay = true and then in onloadeddata pause the video with video.pause().

EDIT 2: Another interesting thing was found. You can set video.currentTime to, for example 5, to capture the 5th second and if the duration of your video is less than, again for example 5s, the last frame will be drawn on the canvas. And then you can set it back to zero inonloadeddata event. It is good because in most cases the first seconds are black.

JavaScript
JavaScript

Advertisement

Answer

I have no idea what is the problem

Seems like preload: auto helps, but I’m not sure

Handling multiple events at once makes it work, but not always

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement