Open Bug 1625012 Opened 6 years ago Updated 1 month ago

Add Picture-in-Picture support

Categories

(GeckoView :: General, enhancement, P3)

Unspecified
Android
enhancement

Tracking

(Not tracked)

People

(Reporter: jonalmeida, Unassigned)

References

Details

Attachments

(1 file)

Currently, for PiP, we take the entire GeckoView and put into PiP-mode. This works well enough for now (you can see this in R-B by putting a video into fullscreen mode and then pressing the home button).

Product's request is to also be able to view a video while also being able to browse web content.

An API that would provide the media element in a View would be helpful in being able to do this.

A related WebView API that does this when an element goes in fullscreen, is to provide the element to the embedder.

I spent some time thinking about this a while back. Maybe something like the following?

class MediaElement {
    ...
    void enterPiP() { ... }
    boolean isPip() { ... }
    void exitPip() { ... }
}

interface MediaElement.Delegate {
    GeckoResult<Surface> onPipEnter();
    void onPipExit();
}

We could then hook up the video controls to allow pip similar to desktop.

Priority: -- → P2

Yes, that looks about right.

We could then hook up the video controls to allow pip similar to desktop.

We get the video controls for free already. :)

For cases like YouTube, the native controls overlap with the web content ones right now, so you sometimes see two sets of them although you can only interact with the native ones in PiP mode. Receiving a SurfaceView back, I assume that we only get the base video element back?

Attached image controls-overlap.png

What the controls overlap currently looks like.

Whiteboard: [geckoview:m78]
Rank: 5
Whiteboard: [geckoview:m78]
Whiteboard: [geckoview:m79]
Whiteboard: [geckoview:m79]
Depends on: 1623715

Related to this ticket - UX is looking into a way to trigger PiP in Fenix without first fullscreening the app - similar to desktop. No exact plans yet, but maybe showing the PiP button on a tap on the embedded video.

Jonathan, is this bug still relevant? Does Fenix currently support PiP?

Flags: needinfo?(jonalmeida942)

Yes, this bug is still relevant. Comment 1 has a concept of what an API would look like to provide better browser PiP support that integrates with Android's native PiP support.

For example, currently we can be in PiP and not use the browser for anything else. If we're able to tell Android, "draw this video on this other surface" we would then be able to browse on a tab while using PiP for a video at the same time.

Flags: needinfo?(jonalmeida942)

(In reply to Jonathan Almeida (:jonalmeida) from comment #6)

Yes, this bug is still relevant. Comment 1 has a concept of what an API would look like to provide better browser PiP support that integrates with Android's native PiP support.

For example, currently we can be in PiP and not use the browser for anything else. If we're able to tell Android, "draw this video on this other surface" we would then be able to browse on a tab while using PiP for a video at the same time.

How can we enter PiP mode in Geckoview now? I could not find documentation on this. I am trying to do this with YouTube, but have no idea how.

See Also: → 1790171
Severity: normal → S3
Rank: 5 → 222

Enhancements should have severity N/A.

Severity: S3 → N/A
Duplicate of this bug: 1813586

Moving to P3 for bug organizational purposes. If this doesn’t seem right, please reset the priority back to the original value or set to if you think the bug should be re-triaged.

Priority: P2 → P3
See Also: → 1956165
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: