jellyfin-android
jellyfin-android copied to clipboard
Picture-in-picture not working on Android 14
Describe the bug
It appears that since the Android 14 update that PiP does not work. Audio works when "Background audio" is enabled, but PiP video does not, regardless of settings.
Have confirmed that PiP is allowed inside the app settings, battery optimisation is turned off, player type is set to "integrated" (although have tried web player as well) and the app has been reset and reinstalled. Have tried this on multiple Pixel 7 Pro devices to no effect. Don't have any other devices to test with sadly. Other apps have no problem with PiP (eg Google Maps).
Logs
No response
Application version
2.6.0
Where did you install the app from?
Google Play
Device information
Google Pixel 7 Pro
Android version
Android 14, build UQ1A.231205.015
Jellyfin server version
10.8.9
Which video player implementations does this bug apply to?
- [ ] Web player (default)
- [X] Integrated player (ExoPlayer)
- [ ] External player (VLC, mpv, MX Player)
I can confirm that PiP is also not working anymore on my Pixel 7 Pro with Android 14 using the integrated player. PiP still works normally on my secondary Android 13 phone.
Interesting, I'll check it out. Note that only the integrated player supports PiP in the first place.
I did some more testing and noticed that PiP seems to work, if you open a notification from a different app while playing a video, but does not work if you minimise (Home-Button) the app or switch apps via the recents-app-switcher. Maybe that helps a bit in the debugging process.
I just tested on my device with Android 14, and for me, tapping the home button during video playback correctly enters PiP. Note that it won't use PiP while the video is paused. Additionally, when switching to another recent app, PiP won't open either, but that is the intended behavior in Android.
I did some more testing and now I can narrow down the issue even more. If I use the classical 3-Button navigation, pressing the home button will enable PiP mode for Jellyfin, but if the navigation mode is set to gesture navigation (as it is default on all newer Pixel phones), the home-gesture (swiping up) will not trigger PiP for Jellyfin. As far as I could quickly assess, Jellyfin seems to be the only app with his behaviour, all other apps that support PiP also work with gesture navigation. One thing to add: with gesture navigation on Android 13 it is also working fine, so it seems to be related to gesture navigation on Android 14
Thanks for the additional details. I switched my phone (Pixel 5 with Android 14, October security patch) to gesture navigation, and couldn't reproduce that behaviour either. When using the home gesture to go home, the PiP player shows up after a slight delay.
Thanks for your response. I'm not sure if it's then related to the latest "Pixel feature drop" december update. I tried reinstalling Jellyfin, but, unfortunately, this did not resolve the issue. I generated and attached a logcat file while minimising Jellyfin while a video is playing (CTRL+F: LAUNCHER_HOME_GESTURE), maybe that helps. If there is any other way I can help you with this issue, just let me know. logcat.log
I have Pixel 7 on Android 14.
I noticed that the app never uses PlayerFragment
, which is where all of the PiP logic is handled. Playback is being done in WebViewFragment
instead. Since the PiP relies on this line:
override fun onUserLeaveHint() {
for (fragment in supportFragmentManager.fragments) {
if (fragment is PlayerFragment && fragment.isVisible) {
fragment.onUserLeaveHint()
}
}
}
In MainActivity
, PiP will not work. I'm not familiar with Koin, so it's difficult for me to figure out why PlayerFragment
isn't being used on my device.
Update
After reading the other comments more carefully, I see that I was not using the integrated player. After making that switch, PiP works as expected for me.
A little insight into the possible differences between navigation modes. Android 12 added setAutoEnterEnabled
where true
means a lot more of this process is handled by the OS. They specifically call out to this making PiP transitions smoother when using gesture navigation.
https://developer.android.com/develop/ui/views/picture-in-picture#setautoenterenabled
Interesting. On my pixel 8 with android 14 pip is working but the app is killed when in the background after a while (screen off)
Interesting. On my pixel 8 with android 14 pip is working but the app is killed when in the background after a while (screen off)
Some update on this: When I turn off the screen when in pip the player is closed after a while, but if turn off the screen when in the full screen player it stays alive
I'm having issue as well. Pixel 8 pro. Swipe up for home and I only get audio but not PIP. Using integrated player not web.
Might be related but not sure, but noticing the same issue on Android 14 - when we hit close the audio still goes on, this issue is not happening on Android 13. I am using a Samsung Zfold Android 14.
For me, this issue is resolved. It was probably fixed by Jellyfin version 2.6.1 or, but less likely, with a monthly Pixel update.
Update: Seems to have been a fluke. After a reboot, the problem occurs again.
I agree with the above comments regarding gesture navigation on Android 14 being the issue. I don't think I had ever used PIP with Jellyfin on previous Android versions, but here are some things that I have noticed on Android 14:
- Using 3-button navigation, pressing the home button while watching video starts PIP as expected.
- Switching to gesture navigation, gesturing home while watching video just closes the app. No PIP.
- Instead of gesturing home directly from video, when opening the app switcher (making the swipe-up home gesture, but holding your finger in the middle of the screen for a moment) and then performing the standard home gesture, PIP opens and works as expected.
- This is somewhat similar to behavior I noticed with Android 14 gesture navigation breaking a feature in a different application, with the same workaround https://github.com/Neamar/KISS/issues/2184
- Another wonky workaround is to open Jellyfin in split screen, make sure video is playing, and then gesture home normally. This starts PIP.
Application version
2.6.1
Where did you install the app from?
GitHub, libre-release.apk
Device information
Google Pixel 7 Pro
Android version
Android 14, GrapheneOS
Jellyfin server version
10.8.13
Which video player implementations does this bug apply to?
- [ ] Web player (default)
- [x] Integrated player (ExoPlayer)
- [ ] External player (VLC, mpv, MX Player)