-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only play one video in PiP at once. #181
Conversation
// If another video is already in PiP, pause it and exit PiP mode. | ||
if (document.pictureInPictureElement instanceof VideoPlayer) { | ||
document.pictureInPictureElement.videoElement.pause(); | ||
await document.exitPictureInPicture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe await document.exitPictureInPicture();
is not necessary as document.pictureInPictureElement
will exit Picture-in-Picture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beaufortfrancois You're right, thank you. Updated in 599d9ab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit
LGTM. PiP displays one video at a time, and if a second video start on PiP, the first one stops. |
Summary
When initializing the PiP experience, make sure no other video is playing. If it is, exit that PiP experience first and pause the previously playing video before opening a new PiP window.
Fixes #106 #178