Video goes to picture-in-picture then disappears when you tap fullscreen
Categories
(Fenix :: Media, defect, P2)
Tracking
(firefox124 wontfix, firefox125 verified, firefox126 verified)
People
(Reporter: brianpeiris, Assigned: jackyzy823)
References
Details
(Whiteboard: [ux-fun-2024] [qa-triaged] [fxdroid] [group4] [s2-list25?] )
Attachments
(3 files, 1 obsolete file)
Steps to reproduce:
Steps to repro:
- Open Firefox and visit a page with a video, like https://videojs.github.io/autoplay-tests/plain/simple.html
- Switch to any other app, like the Play Store
- Switch back to Firefox.
- Play the video.
- Tap the fullscreen button.
Actual results:
Firefox switches to Android's picture-in-picture mode briefly, before disappearing entirely, but the video continues to play in the background.
I've reproduced this on a fresh install of Firefox Nightly (125.0a1) on my Google Pixel Tablet running Android 14. I originally noticed the issue on Firefox Stable. It does not occur with other video-playing apps like YouTube or Google Chrome.
Expected results:
The video should just play in fullscreen.
Reporter | ||
Comment 1•2 months ago
|
||
I've attached a screen recording of the issue.
Product here could also be GeckoView, just like in 1848266 . You might want to change it
Comment 3•2 months ago
|
||
Hi,
I couldn't reproduce the described issue.
Picture in Picture works as expected (with a second of pause on Pixel before it's activated).
I've used a device close to yours: Google Pixel 7 (Android 14).
Also tried reproducing it on a Samsung Galaxy S23 Ultra (Android 14).
Could you reproduce it on the latest Nightly as well? You could also try on the latest RC (124.0) or latest Beta (125.0b2), or if you don't have anything to loose, you could even try to perform a clear data on the 123 version you reproduced on.
Thank you!
Updated•2 months ago
|
Reporter | ||
Comment 4•2 months ago
|
||
(In reply to Lorand Janos from comment #3)
Hello. I'm still able to reproduce this. To rule out my particular Pixel Tablet, I reproduced it on my Galaxy S21 phone as well, running Android 14.
On the S21, I can reproduce it with a fresh install of Firefox Stable (123.1.0), Nightly (126.0a1), and Beta (124.0b9) -- all installed from the Play Store.
Please note that the issue is with the fullscreen behavior, not the picture-in-picture behavior. Specifically, when I follow the steps, Firefox incorrectly goes into picture-in-picture mode, and then immediately hides the video entirely, when it should just fullscreen the video.
Reporter | ||
Comment 5•2 months ago
|
||
Also note that this only happens the very first time you attempt to fullscreen a video after starting Firefox after quitting the app. Subsequent fullscreen attempts work correctly.
Reporter | ||
Comment 6•2 months ago
|
||
I think I've figured out the key factor here. I'm only able to reproduce this if I disallow or block notifications from Firefox. It seems Firefox attempts to prompt for notifications permissions, when it goes fullscreen. If you block notifications, I think it fails to prompt for notifications permissions, which causes this bug.
I also used mozregression to narrow down the build that caused this issue. I don't think mozregression allows you to bisect to a specific commit for android builds, but it did narrow it down to the nightly released on 2023-09-06.
Here are the good and bad APKs and version details:
119.0a1 (Build #2015972419), 2d460b0327+
GV: 119.0a1-20230905094754
AS: 119.20230903050308
2023-09-05T16:06:38.095648758
119.0a1 (Build #2015972611), e45a12029e+
GV: 119.0a1-20230906091315
AS: 119.20230906050317
2023-09-06T16:08:42.847241023
Comment 7•2 months ago
|
||
Thanks for your very valuable investigation Brian Peiris!
I could actually reproduce the bug once in Nightly following your instructions, and then I couldn't any more, neither in Nightly, neither in release. Even after removing the app's data.
Do you know a way of reproducing the bug again? Does closing the app and opening it again work for you all the time?
Reporter | ||
Comment 8•2 months ago
|
||
Thanks. Yes, I can reproduce this consistently with the following steps, using the current Nightly from the Play Store:
- To start from a clean slate, uninstall Nightly, or Force Stop and Clear all data.
- Open Nightly and choose "Not now" for all the initial setup prompts
- Visit https://videojs.github.io/autoplay-tests/plain/simple.html
- Switch to the Play Store (or any other app)
- Switch back to Nightly
- Play the video
- Fullscreen the video
- Notice at this point it attempts to go into fullscreen, but also shows a prompt to allow notification permissions, which causes the video to go into picture-in-picture (PiP)
- Tap "Don't allow" in the notification permission prompt
- Notice the PiP video disappears at this point, but its audio is still playing in the background
- Open Nightly from its app icon
- Notice the notification permission prompt appears again.
- Tap "Don't allow" again
- While the video is still playing, switch back to the Play Store
- Switch back to Nightly
- Attempt to fullscreen the video
- Notice the video fails to fullscreen, and even the PiP disappears
- Open Nightly from its app icon
- While the video is still playing, switch back to the Play Store
- Switch back to Nightly from its app icon
At this point you can repeat steps 16-20 to reproduce the issue consistently, as long as the video is still playing. The important step seems to be switching to another app, and then back to Nightly. You may also notice that the video starts to get choppy, which seems to be the performance issue mentioned in bug 1848266
Comment 9•2 months ago
|
||
I can 100% reproduce the bug now, thanks a lot!
I realise I was switching from Fenix to the Play Store using the "Running apps" list and it doesn't reproduce the bug.
Going back to the "Home" screen and launching the app from there reproduces the bug all the time.
It will be a lot easier to work on this bug now that we know how to reproduce it. Thanks a lot for your help on that!
Reporter | ||
Comment 10•2 months ago
|
||
Glad to hear it! Thanks for confirming the issue.
Assignee | ||
Comment 11•2 months ago
|
||
Hi Brian Peiris,
Your investigation and STR is marvelous .
But i think the bisection might not be accurate. I've tested and uploaded a video which demonstrates the same issue , but it was started at least from 9 months ago on 115.0b5 .
Assignee | ||
Comment 12•2 months ago
•
|
||
Some guess:
-
What PiP is activated? https://searchfox.org/mozilla-central/rev/47a0a01e1f7ad0451c6ba6c790d5c6855df512c1/mobile/android/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/PictureInPictureFeature.kt#49
Because it was trigger byonHomePressed
-
Why
onHomePressed
activated
https://searchfox.org/mozilla-central/rev/47a0a01e1f7ad0451c6ba6c790d5c6855df512c1/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt#1680
https://searchfox.org/mozilla-central/rev/47a0a01e1f7ad0451c6ba6c790d5c6855df512c1/mobile/android/focus-android/app/src/main/java/org/mozilla/focus/activity/MainActivity.kt#202
BecauseonUserLeaveHint
is called -
Why
onUserLeaveHint
is called?
handleMediaPlaying
callingupdateNotification
thennotificationsDelegate.notify
and when we haven't granted notification permission, the android system will show a dialog ask user to allow or not.
I guess this dialog will triggeronUserLeaveHint
https://searchfox.org/mozilla-central/rev/47a0a01e1f7ad0451c6ba6c790d5c6855df512c1/mobile/android/android-components/components/feature/media/src/main/java/mozilla/components/feature/media/service/MediaSessionServiceDelegate.kt#151,185
https://searchfox.org/mozilla-central/rev/47a0a01e1f7ad0451c6ba6c790d5c6855df512c1/mobile/android/android-components/components/support/base/src/main/java/mozilla/components/support/base/android/NotificationsDelegate.kt#130,154
Update:
A stack overflow answer also show the problem : https://stackoverflow.com/a/67587797
I'm not sure why it doesn't happens if we skip step 4,5 ( just directly play and fullscreen.)
Updated•2 months ago
|
Updated•2 months ago
|
Assignee | ||
Comment 15•2 months ago
|
||
I'm not sure why it doesn't happens if we skip step 4,5 ( just directly play and fullscreen.)
Ok, i add some log, found that , In just directly play and fullscreen.
situation ,the enterPipModeCompat is also called , but maybe failed to enter PIP mode.
More clearly
- enterPipModeForO (aka
activity.enterPictureInPictureMode(PictureInPictureParams.Builder().build())
) returntrue
with step 4,5 - enterPipModeForO (aka
activity.enterPictureInPictureMode(PictureInPictureParams.Builder().build())
) returnfalse
when directly playing and fullscreen
Assignee | ||
Comment 16•2 months ago
|
||
Assignee | ||
Comment 17•2 months ago
|
||
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 18•2 months ago
|
||
Pushed by tthibaud@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6928f8a72bb Don't call onHomePressed when notification permission prompt is shown. r=android-reviewers,tthibaud
Updated•2 months ago
|
Comment 19•2 months ago
|
||
bugherder |
Reporter | ||
Comment 20•2 months ago
|
||
Thanks for the fix!
Updated•2 months ago
|
Comment 21•2 months ago
|
||
The patch landed in nightly and beta is affected.
:jackyzy823, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox125
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Comment 22•2 months ago
|
||
I don't think this is important to uplift. (Feel free to change this)
Comment 23•2 months ago
|
||
Verified as fixed on the latest Nightly (126.0a1 from 2024-04-05).
The video is played on full screen as expected.
Device used: Samsung Galaxy S23 Ultra (Android 14).
Marking as verified for 126.
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•1 month ago
|
Comment 25•1 month ago
|
||
Comment 26•1 month ago
|
||
Comment on attachment 9398144 [details] [review]
[mozilla-mobile/firefox-android] Bug 1886083 - Don't call onHomePressed when notification permission prompt is shown (#6082)
Beta/Release Uplift Approval Request
- User impact if declined: Users can still experience the following bug:
Video goes to picture-in-picture then disappears when you tap fullscreen.
It's been a hight-frequency complain from users on the PlayStore - Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- 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): Risk is low because the patch as already has already in Nightly for almost 3 weeks
- String changes made/needed:
- Is Android affected?: Yes
Updated•1 month ago
|
Comment 27•1 month ago
|
||
Comment on attachment 9398144 [details] [review]
[mozilla-mobile/firefox-android] Bug 1886083 - Don't call onHomePressed when notification permission prompt is shown (#6082)
Approved for 125.3.0
Comment 28•1 month ago
|
||
Authored by https://github.com/jackyzy823
https://github.com/mozilla-mobile/firefox-android/commit/36588b4d0dc4f4f897324dac43c04eb8317b7d8d
[releases_v125] Bug 1886083 - Don't call onHomePressed when notification permission prompt is shown. r=#android-reviewers
Comment 29•1 month ago
|
||
Verified as fixed on the latest RC 125.3 build 1 with Google Pixel 8 Pro (Android 14).
Description
•