I want to preview the video on <canvas>

Asked 2 years ago, Updated 2 years ago, 28 views


read the file in event.target.files <canvas>.

Could someone tell me how to do it?

javascript html

2022-09-29 22:18

1 Answers

First, obtain the BlobURL of the file at URL.createObjectURL(file) and specify it as the src attribute of the video element that you have prepared.
Next, ctx.drawImage(videoElement,0,0) while playing the video will draw the frame of the moment in Canvas, and you can do it continuously using requestAnimationFrame.


2022-09-29 22:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.