Closed Bug 1647800 Opened 6 years ago Closed 2 years ago

Pip feature Request : Auto trigger

Categories

(Toolkit :: Picture-in-Picture, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: yoann, Assigned: 9wjt17j4z)

References

(Depends on 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Android 10; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0

Expected results:

I couldn't find any settings to activate pip.

The ideal situation would trigger pip when a playing video leaves the viewport or

Please implement this feature. Not just on tab change, but if the window leaves the viewport. I would like to alt-tab to another windows and keep seeing the video.
This feature was also requested here: https://connect.mozilla.org/t5/ideas/auto-pip-when-tab-is-changed/idi-p/7917
and here: https://www.reddit.com/r/firefox/comments/wfjyf0/automatic_pictureinpicture_mode_when_window_focus/

Severity: -- → N/A
Component: Video/Audio Controls → Picture-in-Picture
Priority: -- → P3

I like this idea! Yandex browser mobile\desktop have this great functionality!

Hi,
This is something we are considering for development in the future.

I've been looking for a similar option or extension for a while but was not able to find any.
Having the option to automatically open media in PiP while swapping between tabs improves the UX imo.

Assignee: nobody → danieleferla1
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Updated 2 hours ago, impressive 👏🏼

Thanks for not abandoning this!

Hi Daniele,

Are you still working on this? I responded with some review feedback for your patch. I'm happy to answer any questions you might have about it.

Flags: needinfo?(danieleferla1)

Hi Mike,

Yes, I'm sorry for the wait. Actually I've implemented the architectural changes you proposed (primarily the usage of the "TabSelect" event), but unfortunately I got stuck on a couple of tests failing due to a bug.

Initially, I tried to move the new maybeTogglePiP function to the TabSelect handler of PictureInPicture.sys.mjs, however that handler is executed only if a PiP window has already been manually opened.

To solve that, I've chosen to use the on_TabSelect handler but in tabs.js.
The patch works as expected, but some tests are failing due to the following behaviour.

If a user has two tabs (e.g., "New tab" and "test_video.html"), with "test_video.html" currently active, with a video playing and with PiP deactivated, as soon as the user closes that tab, it blurs to the sibling tab ("New tab") and the TabSelect event is triggered thus my function is called. The JSActor async message PictureInPicture:KeyToggle is sent instantly, but it is actually received by the PictureInPictureChild.sys.mjs when the tab has been already closed, and this results in a blank PiP window.

Using a debugger I have verified that is a synchronization issue. If I introduce a delay (with a breakpoint right before my maybeTogglePiP function) to allow the PiP trigger to complete its execution also in the child actor, the PiP window appears and it's closed right before when its tab is closed, as expected.

Can I upload my current revision so I may receive some help?

Flags: needinfo?(danieleferla1)

(In reply to Daniele Ferla from comment #9)

Can I upload my current revision so I may receive some help?

Absolutely!

Pushed by mconley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9a9833354c99 Picture-in-Picture: auto-toggle on tab switch. r=mconley,fluent-reviewers,settings-reviewers,tabbrowser-reviewers,pip-reviewers,flod
Blocks: 1910505
Regressions: 1910507
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Duplicate of this bug: 1634077
Depends on: 1918087
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: