jellyfin / jellyfin-android

Android Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
1.51k stars 245 forks source link

Playing music stutters when the app is in the background #39

Open Seil0 opened 4 years ago

Seil0 commented 4 years ago

When i'm paying a song with jellyfin open in the background the song start to stutter (sounds like the song stops for a few milliseconds). As soon as i bring jellyfin to the foreground the song continues to play without any issues. Changing between background and foreground always results in this behavior.

Device: Pixel 2 OS: Android 10 (QQ3A.200805.001) Jellyfin App: 2.0.0-rc2 Jellyfin Server: 10.6.2

Maxr1998 commented 4 years ago

Yeah, that's an issue with playing media in WebView. I couldn't reproduce it on my device, but it's definitely a thing. Long-term, we want to switch to a media player integrated into the OS.

LeRaldo commented 3 years ago

This exact issue started happening to me after my phone upgraded to Android 11 today. It was working flawlessly before when I was on Android 10.

Device: OnePlus 8 Pro (IN2025) OS: Oxygen OS 11.IN11AA (Android 11) Jellyfin App: 2.0.1 Jellyfin Server: 10.6.4

aschubert commented 3 years ago

Same issue here with a Amazon Fire HD 10 tablet. Strange thing as a side note: as soon as I connect a bluetooth speaker to the tablet, no dropouts/stuttering sound happens. On other Android devices (MIUI 12) no issue at all.

jariha commented 3 years ago

I have the same issues with Nokia 6.2. I have tested to disable the battery optimization but no help there.

dkanada commented 3 years ago

For now, the suggestion is to use another Jellyfin client that isn't in a web view. At some point music playback will be handled natively at which point these issues should disappear. I suggest either Gelli or Yatse for music playback.

Maxr1998 commented 3 years ago

+1 for Gelli.

The comment I made here applies to this issue as well, that's why I marked it as wontfix.

alexs20 commented 3 years ago

-1 for Gelli. It has track sorting issues and author has no time to fix it It is useless for albums where order is important, for example for audiobooks.

yotoprules commented 3 years ago

-1 for Gelli. It has track sorting issues and author has no time to fix it It is useless for albums where order is important, for example for audiobooks.

that and it keeps causing my whole Jellyfin server to crash: seems to happen when I'm driving which suggests if there's an unstable connection it just screws everything up. Might go back to emby for music for now until there's a usable android client.

dkanada commented 3 years ago

I have yet to see any issue reported for server crashes due to Gelli, so of course the problem isn't fixed yet. That being said, I only know of one other instance in two years of a client crashing the server (Kodi) and it was quickly resolved. Not only that, but obviously a client should never be able to crash the server, so if you opened an issue on the main repository with logs (it wouldn't be a Gelli issue because the server should never crash from clients) I'm sure it would be high priority.

yotoprules commented 3 years ago

I have yet to see any issue reported for server crashes due to Gelli, so of course the problem isn't fixed yet. That being said, I only know of one other instance in two years of a client crashing the server (Kodi) and it was quickly resolved. Not only that, but obviously a client should never be able to crash the server, so if you opened an issue on the main repository with logs (it wouldn't be a Gelli issue because the server should never crash from clients) I'm sure it would be high priority.

I'll see if I can reproduce it, the server didn't completely crash though, it was looping through some error and nothing could connect to it, but forgot what the error was. But I'll check this out tomorrow.

e10kstarfire commented 3 years ago

Same issue pixel 3a Android 11

chrstfer commented 3 years ago

Just want to mention that Yatse doesn't support Jellyfin (audio)books, so yatse is not a good workaround for the stutter/crash problem if you want to listen to audiobooks. It doesn't attempt to look at "Book" media library type.

sevi-kun commented 3 years ago

Same problem here with OnePlus Nord and Android 11.

dkanada commented 3 years ago

Another music client has shown up recently called Finamp on Android and iOS. As usual, I would suggest Gelli, Yatse, or Finamp for anyone experiencing this issue on mobile. If anyone can think of another mobile app for Jellyfin I will add it to this list.

outergod commented 3 years ago

Same here, Android 11 on Pixel 5.

StevenEddies commented 3 years ago

The standard web client seems (at first attempt) to be OK (I'm using Firefox) for those who don't want to pay or sideload.

Maxr1998 commented 3 years ago

I did some more digging, and it seems to be an issue in chromium, which powers the Android WebView. We can possibly work around this if I understand some of the comments correctly, but I need to investigate further first.

Still, the best solution would eventually be a fully native music player app.

notarobot63 commented 3 years ago

Same issue here on Android 11 but with Bromite Webview

dbarenholz commented 3 years ago

Can confirm that the issue is also present on my OP6.

Jellyfin 2.3.2 installed from Google play store. Android 10, Oxygen OS 10.3.12

My current workaround is opening a browser tab (Brave, chromium based) and let that play the music.

snipes040 commented 3 years ago

I have this issue as well Jellyfin 2.3.3 installed from Google play store Redmi Note 6 Pro running Lineage OS 17.1 latest build as of 09/23/2021

Also confirmed that playing music directly from firefox from my server works perfectly.

I really hope this issue gets fixed soon, I love Jellyfin and don't want to go back to Emby :(

eaott commented 3 years ago

Having the same issue. When the app is in the foreground and screen is on, music is clear. Anything else and it stutters. Jellyfin 2.3.3 Google Pixel 4a (5g), Android 11 Tried with using phone speakers and bluetooth speakers and had the same result. Same behavior regardless of whether battery use is being optimized for the Jellyfin app.

iPhone client seems to not have the same issue as far as I can tell.

Like @dbarenholz above, opening a browser tab seems to work fine too.

Happy to try out config changes and report back if anyone has suggestions.

Appoxo commented 2 years ago

Same issue with OnePlus 9 Pro. Apps starts to stutter if it gets in the background. Jellyfin Server: 10.7.7 on ARM Jellyfin Client: 2.3.3 on Android 11

ShadwDrgn commented 2 years ago

same but lineageos 18.1 (android 12) (no gapps) OnePlus 9 Pro here too

samvde commented 2 years ago

Another music client has shown up recently called Finamp on Android and iOS. As usual, I would suggest Gelli, Yatse, or Finamp for anyone experiencing this issue on mobile. If anyone can think of another mobile app for Jellyfin I will add it to this list.

Finamp seems to be very promising and is available in F-Droid. Many thanks for suggesting.

steevithak commented 2 years ago

Same issue. Stutters a little even in foreground but when in background stutters and clicks constantly. Android seems to kill the app or it just dies after a few minutes in the background.

I'm using the Jellyfin Android Google TV app on my Sony TV and it plays perfectly with no stuttering. The bug seems to only affect the Android phone app.

Tried turning off battery and data restrictions/optimization for the app but no effect.

Pixel 4a 5G, Android 12 (build SQ1A.220105.002, kernel 4.19.202) Jellyfin Server: 10.7.7 Jellyfin Android Client: 2.4.2 (from Play store)

Seb3thehacker commented 2 years ago

Same here. Android 11, Oneplus 7 Pro. Stutters almost instantly after minimizing the app. Any news on a fix?

Appoxo commented 2 years ago

Same here. Android 11, Oneplus 7 Pro. Stutters almost instantly after minimizing the app. Any news on a fix?

It seems they fixed it at some point... Jellyfin server: 10.7.7 with LSIO docker Jellyfin client: 2.4.2 Android: 12 Smartphone: OnePlus 9 Pro Tested file: FLAC Behavior: Typing over the Github App on my smartphone while jellyfin is minimized in the background.

ashanrath commented 2 years ago

Same here. Android 11, Oneplus 7 Pro. Stutters almost instantly after minimizing the app. Any news on a fix?

It seems they fixed it at some point... Jellyfin server: 10.7.7 with LSIO docker Jellyfin client: 2.4.2 Android: 12 Smartphone: OnePlus 9 Pro Tested file: FLAC Behavior: Typing over the Github App on my smartphone while jellyfin is minimized in the background.

Try with the screen off.

Appoxo commented 2 years ago

Same here. Android 11, Oneplus 7 Pro. Stutters almost instantly after minimizing the app. Any news on a fix?

It seems they fixed it at some point... Jellyfin server: 10.7.7 with LSIO docker Jellyfin client: 2.4.2 Android: 12 Smartphone: OnePlus 9 Pro Tested file: FLAC Behavior: Typing over the Github App on my smartphone while jellyfin is minimized in the background.

Try with the screen off.

Working. No stutters whatsoever.

Maxr1998 commented 2 years ago

The bug is very device and situation specific. I can still reproduce it on my Pixel 5, Android 11. The upstream issue also hasn't changed since I last commented.

Appoxo commented 2 years ago

The bug is very device and situation specific. I can still reproduce it on my Pixel 5, Android 11. The upstream issue also hasn't changed since I last commented.

Idk when it stopped (currently using finamp) but before I upgraded to Android 12 I had the issue as well. Maybe an Android 11 specific bug?

spartanv7 commented 2 years ago

Same as many others. Audio stutters when playing in the background. Jellyfin Server: 10.7.7-4 Platform: Synology DS1815+ INTEL Atom C2538 Jellyfin Client: 2.4.2 Mobile Platform: Android 11 Google Pixel 2 XL

exaveal commented 2 years ago

Same for me on Android 11 LineageOS with Android Jellyfin app 2.4.4. Battery optimization is turned off for the app.

This makes the app not usable. As soon as the app is in background or screen off, sound start stuttering/lagging.

flaminestone commented 2 years ago

Same problem on Pixel 4a 5g, version 2.4.4. Android android 12. All battary optimization is disabled for app and for all system

Mazon commented 2 years ago

Is there any workaround for audiobooks? Only android client i found is the webview one so using gelli, or finamp don't work or missing something?

foss- commented 2 years ago

https://github.com/jellyfin/jellyfin-android/issues/222#issuecomment-726865105 says

We can't fix this, but it won't be an issue anymore once we have a fully native client, which is in the works. What is this native client? Is there a repo? Has there been progress in the past 18 months?

I love FinAmp but it is not a full solution to this problem, as I can't get audio books into it. When I add my Audiobook library to FinAmp it won't show any albums. Artists do show for that Library but when selecting an artist it says no items found. Besides that, music background playing feels rather essential so would be really great to have it working in Jellyfin main app.

And what is that fully native client being mentioned in the quote?

AlexKalopsia commented 2 years ago

Experiencing the same on Sony Xperia 1II . Using Gelli fixes the issue, but would still rather just use the Jellyfin app

notarobot63 commented 2 years ago

Hi, I know it's not a solution but I switched to Navidrome it's better at handling music collection than Jellyfin. Jellyfin still rocks as a movies/tv shows solution !

Seb3thehacker commented 2 years ago

Hi, I know it's not a solution but I switched to Navidrome it's better at handling music collection than Jellyfin. Jellyfin still rocks as a movies/tv shows solution !

Yeah I use Gelli and Finamp to listen to music on Jellfin. They both work great with no issues. Plus they support playback reporting

fubka commented 2 years ago

Hi, I know it's not a solution but I switched to Navidrome it's better at handling music collection than Jellyfin. Jellyfin still rocks as a movies/tv shows solution !

Does it support Android Auto?

Bitals commented 2 years ago

Felt pretty weird for me because it didn't occur on my ancient Nexus 5 running Lineage 16 or on my a bit less ancient SGS8 with /e/OS Android 9, but now I finally bought a shiny new current gen Fairphone 4 (/e/OS 1.2-r Android 11) with way more horsepower and it stutters like mad. Gelli worked for me too, and it got songs order right for almost all albums I checked so far. Finamp was way worse in this regard. Seems like it's as good as it gets for now, didn't bother with separate audio players for Jellyfin for a long time because the OG app was always good enough.

eliehalimi commented 2 years ago

I found a workaround a few months and forgot to write it here.

Press play from the jellyfin app (to play the music you want) then pause the music. You then open the jellyfin app info (where you can choose to uninstall/force stop/select notifications/select permissions....) Once you are in the app info, just unpause the music from the media control in the notification drop-down and then your music is playing in the background without stutters. (You can then lock your phone, open an app, do whatever you wanted to do since it's playing in the background)

Note: I use Jellyfin 2.4.4 on Android 8.1.0/Oxygen 5.1.9 (OnePlus 6) and I don't know if the app info menu exists in later android versions. If one wants screenshots to explain the steps in a visual way, I could provide some.

IDeletedSystem64 commented 1 year ago

Issue has appeared for me after upgrade to Android 12 on Galaxy A11 with app version 2.4.4

nathanfranke commented 1 year ago

VIDEO in the background works fine without stutters (Settings->Client Settings, set "Video player type" to integrated and enable "Background audio"). Jellyfin should use ExoPlayer for music too.

timotheeandres commented 1 year ago

Same issue here, with LineageOS 18.1 platina on a Xiaomi Mi 8 Lite with Jellyfin 2.4.4

vincentDcmps commented 1 year ago

Same issue on Chromecast google tv

e10kstarfire commented 1 year ago

Interestingly I now have a Pixel 5 with Android 13 and the stutter disappeared which is good.

But it will only play one track at a time, if you try and play an album it stops after one song.

foss- commented 1 year ago

Jellyfin-Android 2.4.4 PixelOS 13 20221119

Can confirm, no more stutters when playing music in background on PixelOS 13. Seems this was resolved in Android 13. Can others confirm as well?

exaveal commented 1 year ago

LineageOS 19 / Android 12 is working fine

AlexKalopsia commented 1 year ago

Xperia 1II / Android 12 / Jellyfin 2.4.4, still experiencing the issue. This is with battery optimization off.