title | date | tag |
---|---|---|
Capture A Single Frame from a HTML Video |
2024-04-03 |
html video console javascript |
This is amazing idea similar to my No Ads Snippet. But this snippet you paste into the console of your browser will open a new window with the current frame you're paused on a video site (like YouTube – it works there!), and allow you you to then right-click and save that sweet frame of video.
Hat tip to the awesome Dave Rupert for the idea.
This will come in useful.
const v = document.querySelector('video')
let c = document.createElement('canvas')
c.height = v.videoHeight || parseInt(v.style.height)
c.width = v.videoWidth || parseInt(v.style.width)
const ctx = c.getContext('2d')
ctx.drawImage(v, 0, 0)
const wnd = window.open('')
wnd.document.write(`<img src="${c.toDataURL()}"/>`)