Created
April 22, 2020 15:01
-
-
Save Jagathishrex/0d70473669ab3a708f94eeba481898bb 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
| var pipWindow; | |
| video.addEventListener('enterpictureinpicture', function(event) { | |
| pipWindow = event.pictureInPictureWindow; | |
| console.log(`> Window size is ${pipWindow.width}x${pipWindow.height}`); | |
| pipWindow.addEventListener('resize', onPipWindowResize); | |
| }); | |
| video.addEventListener('leavepictureinpicture', function(event) { | |
| pipWindow.removeEventListener('resize', onPipWindowResize); | |
| }); | |
| function onPipWindowResize(event) { | |
| console.log(`> Window size changed to ${pipWindow.width}x${pipWindow.height}`); | |
| // Change video quality based on Picture-in-Picture window size. | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment