I am trying to take a screenshot of a predefined time in a movie. So I tried it with the canvas element. The thing is, the video should play when you draw the video image, but I need the image to still be paused. So I tried this:
video.play(); context.drawImage(video,0,0,canvas.width,canvas.height); video.pause();
But, as you can probably imagine, the video pauses before the canvas is made a drawing, which leads to a screenshot. So, is there a callback function for drawImage? In my case, the drawing process takes about 50 ms, but it does not feel safe:
setTimeout(function() { video.pause(); }, 50);
javascript html5 video canvas screenshot
tbleckert
source share