PiP window stays open when switching from a YT music video to an audio only track
Categories
(Toolkit :: Picture-in-Picture, defect)
Tracking
()
People
(Reporter: kpatenio, Assigned: cqr)
References
Details
(Keywords: good-first-bug)
Attachments
(1 external file)
Thanks to Denys [:denyshon] for flagging the issue in https://bugzilla.mozilla.org/show_bug.cgi?id=2043822#c5:
When a video is followed by a track without video content in a queue, and PiP is already open, it is kept for the track without video (showing just a black rectangle with controls). However, if I just start playing a pure audio track (without having PiP open) and then switch tabs, PiP doesn't open.
A more detailed STR:
- Watch a video in YouTube Music, such as a music video, lyric video, etc. Example
- Open PiP for that video or let it auto PiP via "Keep playing videos in Picture-in-Picture when switching tabs" setting
- On the same page and while PiP is still open, click on an audio only track. I can reproduce this by going to the "Related" tab and finding a track to select.
Expected:
- PiP isn't intended for audio only tracks. We don't show the PiP toggle for audio tracks that lack video content. If we had run step #1 with just the audio track, the toggle would not be visible at all. I'd expect PiP to close in this case.
Actual:
- The PiP window stays open and the window is "blank" - all black background. The player controls can still be interacted with.
- However, unlike https://bugzilla.mozilla.org/show_bug.cgi?id=1850561, the window dimension isn't overly tall and narrow; the window appears relatively normal aside from being blank. This might be specific to YouTube Music.
Did a quick check in the debugger for this code when we try to auto close the PiP player on emptied. I would've thought !video || !video.src would catch this, but apparently video is still present in the DOM. The video is a descendent of a div#song-video, which gets set to display: none when we switch over to a new track.
Maybe we need additional checks like video.checkVisibility() to ensure the video is visible before considering keeping PiP open.
Setting as a potential good first bug.
Aside from fixing the issue, we should ensure that current test coverage in https://searchfox.org/firefox-main/source/toolkit/components/pictureinpicture/tests pass.
- Note: if you run the entire suite using
./mach test toolkit/components/pictureinpicture/tests, some unrelated tests might fail, especially if you have multiple monitors open while the tests run. If this happens, it's worth checking if the affected tests still fail when run individually.
Furthermore, we should add a test in https://searchfox.org/firefox-main/rev/e1bdb5893e652b10528c1e5422d3c90ff146b2da/toolkit/components/pictureinpicture/tests/browser_videoEmptied.js accompanying the fix. If video.checkVisibility is enough, I would suggest a test verifying the PiP window eventually closes after an emptied event and after visibly hiding the video element on the page. (E.g. set to display: none, or set height/width to 0).
| Assignee | ||
Comment 3•5 days ago
|
||
Updated•5 days ago
|
Updated•12 hours ago
|
Description
•