Skip to content
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

Video should not be required to pause when playing in picture-in-picture and subsequently removed from the Document #6271

Open
jernoble opened this issue Jan 7, 2021 · 4 comments
Labels
integration Better coordination across standards needed topic: media

Comments

@jernoble
Copy link

jernoble commented Jan 7, 2021

The HTML specification states:

When a media element is removed from a Document, the user agent must run the following steps:
...
2. ⌛ If the media element is in a document, return.
3. ⌛ Run the internal pause steps for the media element.

This makes sense, insofar as removing a media element from the Document removes the ability for the user to pause playback of that media themselves. However, recent additions to the Web Platform allow media which began playback inside a Document to continue outside that document: the Picture-in-Picture API and the Remote Playback API both provide for this ability.

When media is being presented to the user, by the user agent, pausing that presentation when the page makes a Document tree change is at best unnecessary and at worst user-hostile.

I propose replacing the condition of "removed from a Document" with a new condition, something like "visible to the user". That new condition can be exposed by HTML to other specifications, which can set or clear this condition without monkey patching.

@annevk
Copy link
Member

annevk commented Jan 8, 2021

cc @whatwg/media

@beaufortfrancois
Copy link

What is the status of this issue?

@chrisn
Copy link
Member

chrisn commented Mar 21, 2024

@whatwg/media We'd like to move this forward, as it's blocking the progress on the PiP spec. Should we prepare a PR based on @jernoble's recommendation? Although @marcoscaceres and I not sure that visibility is the right condition, as it also applies to Remote Playback, and there's still a way for the web app to pause playback.

@annevk
Copy link
Member

annevk commented Mar 21, 2024

Presumably the media element can still be used to control playback? E.g., setting muted and such works?

I would suggest giving media elements an associated boolean plays outside document which PiP and Remote Playback set and unset appropriately. When it is true, we don't run the internal pause steps in HTML.

We should also make sure that everyone is okay with the implications:

  1. There's a connected media element M.
  2. PiP starts.
  3. M is disconnected from the document.
  4. PiP continues.
  5. M is connected to the same document again. (What happens if it's connected to a different document?)
  6. PiP ends.
  7. M is disconnected.

Is M now paused? What if M was connected to a different document in step 5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Better coordination across standards needed topic: media
Development

No branches or pull requests

4 participants