Closed Bug 1676069 Opened 5 years ago Closed 5 years ago

document.pictureInPictureElement = undefined

Categories

(Core :: DOM: Core & HTML, enhancement)

Firefox 82
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kevin.godell, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

Set a video player into picture in picture mode via the context menu. Check the value of document.pictureInPictureElement. Tested on mac with firefox versions 82.0.2 (64-bit) and 83.0b9 (64-bit);

Actual results:

document.pictureInPictureElement is always undefined.

Expected results:

document.pictureInPictureElement should be null if no video element is in pip mode. It should return the video element if one is in pip mode. This works ok in chrome and edge. In safari, I use webkitPresentationMode of the video element.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core

I don't recall if we plan to implement the PiP API for websites to access. I think my memory says "no, there are no plans to expose PiP to the website", but...

Flags: needinfo?(mconley)

Correct - currently, there are no plans to implement this API. See https://github.com/mozilla/standards-positions/issues/72.

So I think this is WONTFIX for now.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Flags: needinfo?(mconley)
Resolution: --- → WONTFIX

Thanks for the fast response and confirmation that this property is not implemented. I thought that maybe it was moz prefixed and I was ignorant to figure it out. The real-life problem is that when implementing my video streaming solution for the node-red community (https://nodered.org/), I received a feature request to unload a video src when the video element is scrolled out of view in order to save bandwidth. When using intersection observer, the video element is being reported as out of bounds even though it has been elevated to a pip video. I will report back to the node-red users that we will be unable to support pip detection on firefox for the foreseeable future. Thanks for your time.

-kevinGodell

(In reply to kevin.godell from comment #4)
Hmm, isn't that problematic when the video has audio anyways? I hate when something I'm watching (be it in PiP or not) stops playing when I scroll just because, but maybe it's just me :)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)

(In reply to kevin.godell from comment #4)
Hmm, isn't that problematic when the video has audio anyways? I hate when something I'm watching (be it in PiP or not) stops playing when I scroll just because, but maybe it's just me :)

Yes, it would be problematic if it was unexpected behavior. This is a feature that a user turns on to automatically unload a video if it scrolls out of view or when changing tabs and document.visibilityState changes to hidden. I deliberately do not unload a video if it is in fullscreen or pip mode, since obviously the user has intended to keep it visible.

For this instance, I think some video will be worth a thousand comments. https://drive.google.com/drive/folders/16WOJgh8YUOsiOmfzj5TsDEfOXu5EM32-?usp=sharing

Thank you for the comments.

-kevinGodell

You need to log in before you can comment on or make changes to this bug.