-
Notifications
You must be signed in to change notification settings - Fork 38
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
How to determine type of leaving picture in picture mode ? #228
Comments
It's not possible as far as I know. Out of curiosity, what is your case? |
@beaufortfrancois I have a streamer page that has a video element, once I open the picture-in-picture window and switch to other page. I need to go back to the streamer page by clicking the |
There's a workaround to solve this issue, but it fails for the paused video. |
Sorry, it's not clear to me what's the use case yet. video.onleavepictureinpicture = (event) => {
if (event.reason == "backToTab") {
// What would you differently?
} else {
// Do what you do.
}
}; |
@beaufortfrancois Hey, appreciate your response. Then it would allow me to go back to the original streamer page by clicking the “Back to tab” button of pip video. It’s not really a full page redirect, it’s a frontend route change triggered by vue router. ( I hide my video element in other page, but it’s still on DOM tree ) |
@beaufortfrancois I don’t know if my use case is common or not, most of the demos I see online that “back to tab” usually happens on the same page. |
I wonder if using the Page Visibility API would be enough in your use case to know when the tab is visible again. What do you think? |
Probably not, because it’s on the same tab. |
YouTube has a similar approach, but it’s done with a regular fixed position DOM element ( not using pip api ) |
You may want to use the Document Picture-in-Picture API. Look at https://developer.chrome.com/docs/web-platform/document-picture-in-picture/ |
Yes, documentPictureInPicture is a desirable solution if it has a better browser support rate. |
I've created a simple demo video to illustrate the use case. |
In above video, when I click the close button, I want to stay in the about page. |
We'll monitor how many people will vote for this issue then and we'll see if adding a reason string should be added to the |
Sure, thank you for your support : ) |
Is there any way to determine what button was triggered in
leavepictureinpicture
event ?The text was updated successfully, but these errors were encountered: