Last active
March 23, 2024 21:24
-
-
Save ntippie/baf0e8d7ea682c3889c954c46fb29614 to your computer and use it in GitHub Desktop.
Video Picture-in-Picture Bookmarklet w/ Shadow DOM support
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:(function(){ function findAllVideosIncludingShadowDOM(startingElement) { let videos = []; function searchForVideos(node) { if (node.tagName === 'VIDEO') videos.push(node); if (node.shadowRoot) searchForVideos(node.shadowRoot); if (node.childNodes.length) node.childNodes.forEach(searchForVideos); } searchForVideos(startingElement); return videos; } var video = findAllVideosIncludingShadowDOM(document)[0]; video.removeAttribute('disablePictureInPicture'); video.requestPictureInPicture(); })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment