w3c / picture-in-picture

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

Enter Picture-in-Picture without user activation if document.pictureInPictureElement is set #116

Closed beaufortfrancois closed 5 years ago

beaufortfrancois commented 5 years ago

@mounirlamouri suggested offline we may want to allow video to enter Picture-in-Picture without user activation if there's already a visible PiP window in the context of the document, in other words if document.pictureInPictureElement is set.

  The {{requestPictureInPicture()}} method, when invoked, MUST
  return <a>a new promise</a> |promise| and run the following steps <a>in
  parallel</a>:

  1. Let |video| be the video element on which the method was invoked.
- 2. Let |userActivationRequired| be `true`.
+ 2. Let |userActivationRequired| be `true` if {{pictureInPictureElement}} is
+     null. It is `false` otherwise.
  3. Let |playingRequired| be `false`.
  4. Run the <a>request Picture-in-Picture algorithm</a> with |video|,
      |userActivationRequired|, and |playingRequired|.

This could help in situations where there are multiple video elements for one PiP media session.

What do you think @jernoble @scottlaw?

mounirlamouri commented 5 years ago

Note that this is an idea I had to help with some feedback we got from JWPlayer. They seem to be running ads and content in different

OrenMe commented 5 years ago

I also support this proposal, and I was looking to see if someone already opened an issue on ad interoperability as a matter of fact. In client side ad insertion ads are usually played on another video tag to allow main content to load or keep buffering while ad is playing. Switching between main content and ad content is in same video element is harder to manage, requiring to detach the source buffer and re attaching it, and this is if one has control over all aspects of the video and ad, which is, for example, not the case with popular ad SDK like IMA ada SDK. Another aspect of this interactivity is additional controls over pip element, to enable skipping add or putting a notice that current content is an advertisement. This can be like a media session control maybe type of interface. Maybe this is already a different subject and requires a new issue. Let me know and I’ll open a separate one.

scottlow commented 5 years ago

I think this proposal makes sense.

@OrenMe I believe the controls scenario you're describing is covered by the existing reference to Media Session and the skipad action defined there.

beaufortfrancois commented 5 years ago

@OrenMe You may want to have a look at https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/l6sW0G4jzhE. We're going to experiment with a Skip Ad button in the Picture-in-Picture window.

image

OrenMe commented 5 years ago

thanks @scottlow, @beaufortfrancois - indeed it answers. So having this and the user gesture will definitely answer this scenarios. Usually for ads there's also the aspect of ad timer and ad timer to skip - are you also considering this somewhere?

beaufortfrancois commented 5 years ago

If @jernoble is OK with that change, spec will be updated.

jernoble commented 5 years ago

I'm OK with this. It has a low potential for misuse and a compelling use case.