Closed Bug 1961487 Opened 4 months ago Closed 2 months ago

Automatic PiP does not trigger if the button is disabled

Categories

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

Firefox 137
defect

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: aestheticrice, Assigned: jp, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0

Steps to reproduce:

Enable PiP when switching tabs
media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled = true
Disable PiP button in-video
media.videocontrols.picture-in-picture.video-toggle.enabled = false
Restart browser

Actual results:

PiP no longer shows up when switching tabs. I can trigger PiP through the context menu, but it still does not switch automatically.

Expected results:

PiP window opens when switching tabs regardless of the button's visibility.

The Bugbug bot thinks this bug should belong to the 'Toolkit::Picture-in-Picture' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Picture-in-Picture
Product: Firefox → Toolkit

Thanks for the bug report. So I can confirm the issue, but looking at where we dispatch and listen for events to make auto-pip work, I'm not sure that we can easily ditch the dependency on the toggle.

Mike, am I understanding correctly that we're relying on the toggle to track a video's visibility state? Do you think there's anything we can do here to avoid it?

Flags: needinfo?(mconley)

It looks like the toggle enabled pref is used to determine whether or not we register videos for consideration for PiP: https://searchfox.org/mozilla-central/rev/4c065f1df299065c305fb48b36cdae571a43d97c/toolkit/actors/PictureInPictureChild.sys.mjs#316-318

This also means that if the toggle is enabled, after a restart, the URL bar toggle will also not be available.

Fixing this might be as simple as:

  1. Removing this part of the conditional so that we always register videos
  2. Get rid of this handler for registering videos if the pref is flipped to true: https://searchfox.org/mozilla-central/rev/4c065f1df299065c305fb48b36cdae571a43d97c/toolkit/actors/PictureInPictureChild.sys.mjs#395-404
Mentor: mconley
Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mconley)
Keywords: good-first-bug
Priority: -- → P3
Assignee: nobody → jp
Attachment #9491893 - Attachment description: WIP: Bug 1961487 - Remove condition on toggleEnabled → Bug 1961487 - Remove condition on toggleEnabled r=mconley
Status: NEW → ASSIGNED
Attachment #9491893 - Attachment description: Bug 1961487 - Remove condition on toggleEnabled r=mconley → Bug 1961487 - Fix Automatic PiP does not trigger if the button is disabled
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: