w3c / picture-in-picture

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

Interaction with page visibility #80

Closed ewoerner closed 5 years ago

ewoerner commented 6 years ago

It is not entirely clear how the picture-in-picture API interacts with the page visibility API when the picture-in-picture video is visible but the browser itself is minimized:

Page visibility API, visibilityState attribute defines (emphasis added):

On getting, the visibilityState attribute the user agent must run the steps to determine the visibility state:

  1. Let doc be the Document of the top level browsing context.
  2. If the defaultView of doc is null, return hidden.
  3. Otherwise, return the VisibilityState value that best matches the visibility state of doc:
    1. Return "visible" if:
      1. The user agent is not minimized and doc is the foreground tab.
      2. The user agent is fully obscured by an accessibility tool, like a magnifier, but a view of the doc is shown.
    2. Return "hidden" if:
      1. The user agent is minimized.
      2. The user agent is not minimized, but doc is on a background tab.
      3. The user agent is to unload doc.
      4. The Operating System lock screen is shown.

From this section it looks like visibilityState should be "hidden" in such a situation.

However, the enum definition says (emphasis added):

visible The Document is at least partially visible on at least one screen. This is the same condition under which the hidden attribute is set to false.

From this section it looks like visibilityState should be "visible" in such a situation.

It would probably be a good idea to specify the interaction with page visibility explicitly in the picture-in-picture API.

beaufortfrancois commented 6 years ago

Thank you @ewoerner for this. I've started a PR at https://github.com/WICG/picture-in-picture/pull/82 to address your feedback. Let me know what you think