Closed Bug 1679314 Opened 4 years ago Closed 3 years ago

If the tab which PIP video belongs to is in the background, then resuming PIP video won't request wakelock

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

VERIFIED FIXED
86 Branch
Tracking Status
firefox84 --- wontfix
firefox85 --- fixed
firefox86 --- verified

People

(Reporter: whimboo, Assigned: alwu)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files)

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0 ID:20201121092754

Usually when watching movies in fullscreen the timer to put the machine into sleep / hibernation is getting ignored, and the machine stays active. This behavior is not the case when watching a video in a fullscreen picture-in-picture window.

Hey alwu, is this something that bug 1659060 should have fixed?

Flags: needinfo?(alwu)

Yes, it should be fixed already by bug 1659060, but that would only be true if video is playing.

I checked the latest Nightly, we did request the screen wakelock for playing PIP video, so I were not able to reproduce this issue. I tested it on MacOS 10.14 and 11.0.


Henrik,
So you computer goes to sleep mode even if you're playing a PIP video? Or you just put the video in PIP mode, but didn't play it?
Would you mind to show me the result from running pmset -g assertions when you're playing PIP video?
Thank you.

Flags: needinfo?(alwu) → needinfo?(hskupin)

Hm, when running this command I can clearly see Firefox listed:

   pid 66601(firefox): [0x0010d0f600019f5b] 00:00:02 NoIdleSleepAssertion named: "audio-playing"
   pid 66601(firefox): [0x0010d0f600059f5c] 00:00:02 NoDisplaySleepAssertion named: "video-playing"
``

Not sure what actually happened at that time so let me close this bug as incomplete, and I will reopen again if I can see it again.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(hskupin)
Resolution: --- → INCOMPLETE

I just had the problem again with Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0 ID:20201122152513

Here the output again:

➜ pmset -g assertions
2020-12-11 14:10:42 +0100
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 171(hidd): [0x00164f8e000989b6] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle serviceID:1012c154b name:AppleHIDKeyboardEve product:Apple Internal Keyb eventType:3"
	Timeout will fire in 300 secs Action=TimeoutActionRelease
   pid 214(coreaudiod): [0x00164e440001880d] 00:05:54 PreventUserIdleSystemSleep named: "com.apple.audio.e8-07-bf-ae-c8-60:output.context.preventuseridlesleep"
	Created for PID: 66605.
   pid 38434(Skype Helper (Renderer)): [0x00058ea30001a012] 713:25:33 PreventUserIdleSystemSleep named: "NDI realtime UDP sending"
Kernel Assertions: 0x4=USB
   id=1117  level=255 0x4=USB mod=01.01.70, 01:00 description=com.apple.usb.externaldevice.14300000 owner=Yubikey 4 OTP+U2F+CCID
Idle sleep preventers: IODisplayWrangler

There are n entries for Firefox included.

Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---
Summary: Picture-in-Picture fullscreen window doesn't prevent machine to go into sleep mode → Picture-in-Picture window doesn't prevent machine to go into sleep mode

Also this does not only occur in fullscreen, but also in window mode. Triggering pause/play a couple of times didn't make a difference. But when I moved the video back into the normal browser window, the entries for Firefox appear again.

Could you describe what steps you did before you run pmset -g assertions in comment4?

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] (away 12/07 - 12/11) from comment #5)

Also this does not only occur in fullscreen, but also in window mode. Triggering pause/play a couple of times didn't make a difference. But when I moved the video back into the normal browser window, the entries for Firefox appear again.

So what you meant is that when you play media normally, which is not in either fullscreen or PIP window, Firefox didn't request any wakelock even if media is playing? (is that audible? is the video playing on the foreground)

Thank you.

Flags: needinfo?(hskupin)

Sorry when I was unclear, but with window mode I still meant PiP (not fullscreen). Playing videos within the browser window is all fine.

I haven't figured out steps yet. Maybe related to sleep mode, switching between battery and a/c. I will keep an eye on it.

Flags: needinfo?(hskupin)

So when that issue happens, if you set the video back to normal mode (not in PIP and fullscreen) and start it again, will Firefox request wakelocks?

I haven't figured out steps yet. Maybe related to sleep mode, switching between battery and a/c. I will keep an eye on it.
Sounds good, hope you can find steps, thank you!

(In reply to Alastor Wu [:alwu] from comment #8)

So when that issue happens, if you set the video back to normal mode (not in PIP and fullscreen) and start it again, will Firefox request wakelocks?

Yes, going back into PiP mode again, keeps the wakelocks enabled.

Ok, I think I figured out. Here the steps:

  1. Open two tabs with individual videos
  2. Start playing one video and move it into a PiP window
  3. Stop playing the video in the PiP window
  4. Switch to the other tab and play the video for a moment; then pause it
  5. Switch back to the PiP window and continue playing the video

After step 5 no wakelocks are enabled.

Thank you for the steps! I can reproduce it. Will take a look.

Assignee: nobody → alwu
Severity: -- → S3
Status: REOPENED → NEW
Component: Video/Audio Controls → Audio/Video: Playback
Priority: -- → P3
Product: Toolkit → Core
Blocks: wakelock
Blocks: 1682418

No one is using NewWakeLockOnBehalfOfProcess() so we can remove it and its related methods.

In order to determine the hidden status of wakelock correctly, we should always consider the PIP state.

Depends on D99726

Summary: Picture-in-Picture window doesn't prevent machine to go into sleep mode → If the tab which PIP video belongs to is in the background, then resuming PIP video won't request wakelock
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d94d067d265f
part1 : remove unused methods. r=smaug
https://hg.mozilla.org/integration/autoland/rev/7da73c89dd93
part2 : always use `IsDocumentInvisible()` to determine hidden state of wakelock. r=smaug
https://hg.mozilla.org/integration/autoland/rev/ee6b7ecf08dc
part3 : move PIP video test to a new test file and increase test cases. r=smaug
Status: NEW → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch

The patch landed in nightly and beta is affected.
:alwu, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(alwu)

Comment on attachment 9193140 [details]
Bug 1679314 - part1 : remove unused methods.

Beta/Release Uplift Approval Request

  • User impact if declined: user's screen would be off unexpectedly even if a user is playing video being used in picture-in-picture mode.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): These patches didn't introduce new feature or behavioral change, they help to prevent computer from going sleeping by considering the picture-in-picture video's visibility. Also comes with automation test to prevent the issue happening again.
  • String changes made/needed: no
Flags: needinfo?(alwu)
Attachment #9193140 - Flags: approval-mozilla-beta?
Attachment #9193141 - Flags: approval-mozilla-beta?
Attachment #9193142 - Flags: approval-mozilla-beta?

Thanks, that works fine now with Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:86.0) Gecko/20100101 Firefox/86.0 ID:20201218095607.

Status: RESOLVED → VERIFIED

Comment on attachment 9193140 [details]
Bug 1679314 - part1 : remove unused methods.

Approved for 85.0b4.

Attachment #9193140 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9193141 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9193142 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: