Closed Bug 1565117 Opened 8 months ago Closed 8 months ago

Picture-in-picture launches off screen when using multiple monitors

Categories

(Toolkit :: Video/Audio Controls, defect, P2)

68 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla70
Tracking Status
firefox70 --- verified

People

(Reporter: peternm22, Assigned: mconley, NeedInfo)

References

Details

Attachments

(4 files)

Attached image fY5Xw8x.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Clicked the picture-in-picture button on a video when using multiple monitors.

Actual results:

The picture-in-picture window is launched mostly off the screen, and needs to be dragged to be fully visible. If I disable my secondary monitor, the picture-in-picture window is launched correctly. I've attached a screenshot to this post, notice the small window on the bottom right corner of the screenshot.

Expected results:

The picture-in-picture window should launch fully visible, and not mostly off of the screen.

Blocks: 1527926
Attached image displaysettings.png
Comment on attachment 9077315 [details]
displaysettings.png

Doing further testing, this bug seems to present itself only when the monitors are in certain orientations. If the monitor I am using Firefox on is positioned "lower" than the top of the other monitor, then the PIP window isn't positioned correctly. However, if the monitor I am using Firefox on is position "above" the top of the other monitor, the PIP window seems to work correctly.

What are the size/resolution and Windows (text) scaling settings for your monitors?

Flags: needinfo?(petermarsan)
See Also: → 1474783

(In reply to :Gijs (he/him) from comment #3)

What are the size/resolution and Windows (text) scaling settings for your monitors?

Monitor 1 is 1920x1080, and monitor 2 is 1440x900 (monitor 2 is the monitor that I use Firefox on). Scaling is set to 100%.

Flags: needinfo?(petermarsan)

(In reply to Peter from comment #4)

(In reply to :Gijs (he/him) from comment #3)

What are the size/resolution and Windows (text) scaling settings for your monitors?

Monitor 1 is 1920x1080, and monitor 2 is 1440x900 (monitor 2 is the monitor that I use Firefox on). Scaling is set to 100%.

So just to be really sure (because this is somewhat surprising to me) - both screens are using 100% scaling and neither are using hidpi (if you're comfortable with devtools, if you put Firefox on both screens in turn and evaluate window.devicePixelRatio in the console for both, it reports 1 on both screens) ? In about:config, is layout.css.devPixelsPerPx set to its default (-1.0) value?

Flags: needinfo?(petermarsan)

Hey Cristian, do you think you'd have a moment to help us confirm this issue?

Flags: needinfo?(george.craciun)

Hey Mike, I didn't managed to reproduce the issue reported, but I've noticed some inconsistencies with the position of the PiP window. If the browser is displayed on the entire screen (not full screen mode) on the second monitor the PiP window is displayed ok. If the browser window is resized to a smaller size, the PiP window will be displayed smaller and in a different position (more central and above the taskbar with a few centimeters).

I didn't notice any differences when the position of the second screen was lower. I've only attached the screenshot with the default position of the second screen. I didn't managed to reproduce the behavior from Comment 2.

Flags: needinfo?(george.craciun)

(In reply to :Gijs (he/him) from comment #5)

(In reply to Peter from comment #4)

(In reply to :Gijs (he/him) from comment #3)

What are the size/resolution and Windows (text) scaling settings for your monitors?

Monitor 1 is 1920x1080, and monitor 2 is 1440x900 (monitor 2 is the monitor that I use Firefox on). Scaling is set to 100%.

So just to be really sure (because this is somewhat surprising to me) - both screens are using 100% scaling and neither are using hidpi (if you're comfortable with devtools, if you put Firefox on both screens in turn and evaluate window.devicePixelRatio in the console for both, it reports 1 on both screens) ? In about:config, is layout.css.devPixelsPerPx set to its default (-1.0) value?

Just to verify that we are talking about the same thing, when you refer to scaling, are you referring to the Windows settings in Display Settings > Scale and Layout? If so, both monitors are set to "100% (Recommended)". Neither monitor is high DPI (main monitor is 19" and the other is a 40" TV), so I've never had a need to mess with these settings.

Under Tools > Web Developer > Web Console, inputting window.devicePixelRatio returns 1 on both monitors.

In about.config, I can also confirm that layout.css.devPixelsPerPx is set to -1.0

Flags: needinfo?(petermarsan)
Priority: -- → P2

I looked into this. The problem is that we're using left and top coordinates here to position the PiP player window, and this calculation's origin happens to be at the top-left of the parent window's screen. However, the openWindow method we're using here is using the total available display area when computing where the put the newly opened window.

So we've gotta adjust these calculations to be origin'd at the 0,0 of the total available display "rect".

Assignee: nobody → mconley
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b94f563baf1
Add better multi-monitor support for Picture-in-Picture. r=JSON_voorhees
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Hi Peter,

Do you have a copy of Firefox Nightly? A patch to fix this issue just landed in Firefox Nightly, and I wondered if you'd like to try it. You can download a copy of Nightly here.

Flags: needinfo?(peternm22)

(In reply to Mike Conley (:mconley) (:⚙️) from comment #14)
Hi MIke,

Just tried the Nightly build. and I can confirm it's working correctly now. Thanks so much!

Flags: needinfo?(peternm22)

Build ID 20190723034754
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Verified as fixed on the latest Nightly build on Windows 10.

Status: RESOLVED → VERIFIED

This still happens to me. The pic-in-pic is opened on my TV which is the left screen if the Firefox window is close to the edge (maximized or not). If I move the Firefox window something like 20 pixels from the edge it opens on the right screen.

(In reply to ecke101 from comment #18)

This still happens to me. The pic-in-pic is opened on my TV which is the left screen if the Firefox window is close to the edge (maximized or not). If I move the Firefox window something like 20 pixels from the edge it opens on the right screen.

Please file a new bug. Please also clarify what OS you're using, provide some more details about the displays (resolution, positioning, which is primary) and (based on the 20px thing), mention where the taskbar/dock or similar is positioned. :-)

Flags: needinfo?(ecke101)
You need to log in before you can comment on or make changes to this bug.