Last active
March 7, 2024 18:04
-
-
Save brunurd/d6ca1de4f1d738ca6956d073a0565c3c to your computer and use it in GitHub Desktop.
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
// short way. | |
document.querySelectorAll('video')[0].disablePictureInPicture=false;document.querySelectorAll('video')[0].requestPictureInPicture(); | |
// long way. | |
const pInP = async el => { | |
el.disablePictureInPicture = false; | |
await el.requestPictureInPicture(); | |
} | |
const videos = document.querySelectorAll('video'); | |
pInP(videos[0]); | |
// close via code: | |
document.exitPictureInPicture(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment