w3c / picture-in-picture

Picture-in-Picture (PiP)
https://w3c.github.io/picture-in-picture
Other
311 stars 39 forks source link

Add "Interaction with Page Visibility" section #82

Closed beaufortfrancois closed 5 years ago

beaufortfrancois commented 6 years ago

FIX #80


Preview | Diff

ewoerner commented 6 years ago

With the PR, the following case is treated as "visible", which is probably not intended:

  1. video is in PiP mode and
  2. lock screen is active
beaufortfrancois commented 6 years ago

Indeed! I've updated PR.

ewoerner commented 6 years ago

@beaufortfrancois looks good to me now, thank you.

beaufortfrancois commented 6 years ago

@mounirlamouri I've tried Safari and it looks like Picture-in-Picture doesn't make any difference.

@jernoble, is that intended? Shall we set visibilityState attribute to be "visible" when pictureInPictureElement is set even when document is in background.

mounirlamouri commented 5 years ago

To summarise a discussion @beaufortfrancois and I had offline: Chrome Android auto-PIP exposes that the page is hidden but Chrome desktop PIP feature seems to make the page visible by default. This isn't intentional and I'm actually surprised it does. I do understand some of the concerns shared from the bug report but my understanding is that these concerns are mostly for backward compatibility and websites expecting PIP should be using the API discover the state. I do not have a strong opinion either way but compatibility matters here.

beaufortfrancois commented 5 years ago

For info, you can play with PiP and Page Visibility API at https://beaufortfrancois.github.io/sandbox/media/picture-in-picture-playground

@mounirlamouri I wasn't able to see document.visibilityState set to hidden when video plays AutoPiP in Chrome for Android in Canary. Did I miss anything?

mounirlamouri commented 5 years ago

@beaufortfrancois I may have been very wrong :)

Though, the compatibility point still applies but between Safari and Chrome I guess.

beaufortfrancois commented 5 years ago

After talking to @jernoble at TPAC 2018, we agreed we should go ahead with this PR.

@mounirlamouri We'd have to fix Chrome for Android implementation of AutoPiP to make sure that document.visibilityState is visible when video is in Picture-in-Picture.

mounirlamouri commented 5 years ago

Safari would also need to update its implementation, right?

jernoble commented 5 years ago

Yes, and we'd like to.

beaufortfrancois commented 5 years ago

FYI I've filed https://bugs.chromium.org/p/chromium/issues/detail?id=898495 to make sure Chromium implementation is updated accordingly.