Below snippets can be used in console or bookmark to perform the desired actions.
Last active
July 22, 2022 11:52
-
-
Save t-wy/eacb0b79fe31e4fd2628cd5d55f2632d to your computer and use it in GitHub Desktop.
HTML Video Element Useful Snippets
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
javascript: { | |
let video = document.getElementsByTagName("video")[0]; | |
let canvas = document.createElement("canvas"); | |
canvas.width = video.videoWidth; | |
canvas.height = video.videoHeight; | |
canvas.getContext("2d").drawImage(video, 0, 0, canvas.width, canvas.height); | |
canvas.style.position = "fixed"; | |
canvas.style.left = "0"; | |
canvas.style.top = "0"; | |
canvas.style.zIndex = "99999"; | |
document.body.appendChild(canvas); | |
canvas.toBlob((blob) => { | |
navigator.clipboard.write([ | |
new ClipboardItem({ "image/png": blob }) | |
]).then(function() { | |
document.body.removeChild(canvas); | |
alert("Done!"); | |
}, function (){ | |
alert("Error!"); | |
}); | |
}, "image/png"); | |
} | |
// Capture the Current Frame of the Video and copy to Clipboard |
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
javascript: { | |
let video = document.getElementsByTagName("video")[0]; | |
video.removeAttribute("disablepictureinpicture"); | |
video.requestPictureInPicture(); | |
} | |
// Open Video in Picture in Picture |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment