Last active
November 13, 2023 01:30
-
-
Save rbrahul/1345c83d993868208152c67e5985a99c to your computer and use it in GitHub Desktop.
Capture Screenshot from Youtube Video
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.createElement('canvas'); | |
canvas.width = 640; | |
canvas.height = 480; | |
var ctx = canvas.getContext('2d'); | |
var video = document.querySelector(".html5-video-container > video"); | |
ctx.drawImage(video, 0, 0, canvas.width, canvas.height); | |
var dataURI = canvas.toDataURL('image/jpeg'); | |
console.log(dataURI); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment