Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Seil0 opened this issue Aug 23, 2020 · 62 comments
Open

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

Seil0 opened this issue Aug 23, 2020 · 62 comments
Labels
bug Something isn't working confirmed Confirmed bug reports that shouldn't go stale upstream An issue that is not related to the app, but an upstream component (dependency, backend, web UI) wontfix This will not be worked on

Comments

@Seil0
Copy link

Seil0 commented Aug 23, 2020

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
Copy link
Member

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
Copy link

LeRaldo commented Oct 25, 2020

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
Copy link

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
Copy link

jariha commented Nov 12, 2020

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

@dkanada
Copy link
Member

dkanada commented Nov 12, 2020

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 Maxr1998 added upstream An issue that is not related to the app, but an upstream component (dependency, backend, web UI) wontfix This will not be worked on labels Nov 13, 2020
@Maxr1998
Copy link
Member

+1 for Gelli.

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

@alexs20
Copy link

alexs20 commented Dec 7, 2020

-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
Copy link

-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
Copy link
Member

dkanada commented Dec 16, 2020

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
Copy link

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
Copy link

Same issue pixel 3a Android 11

@chrstfer
Copy link

chrstfer commented Mar 5, 2021

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
Copy link

Same problem here with OnePlus Nord and Android 11.

@dkanada
Copy link
Member

dkanada commented Apr 20, 2021

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
Copy link

Same here, Android 11 on Pixel 5.

@StevenEddies
Copy link

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
Copy link
Member

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
Copy link

Same issue here on Android 11 but with Bromite Webview

@dbarenholz
Copy link

dbarenholz commented Sep 6, 2021

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
Copy link

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
Copy link

eaott commented Sep 27, 2021

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.

@Mazon
Copy link

Mazon commented Apr 29, 2022

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-
Copy link

foss- commented May 1, 2022

#222 (comment) 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
Copy link

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

@notarobot63
Copy link

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
Copy link

Seb3thehacker commented Jun 20, 2022

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
Copy link

fubka commented Jul 22, 2022

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
Copy link

Bitals commented Aug 11, 2022

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
Copy link

eliehalimi commented Aug 19, 2022

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
Copy link

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

@nathanfranke
Copy link

nathanfranke commented Nov 10, 2022

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
Copy link

timotheeandres commented Nov 15, 2022

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

@vincentDcmps
Copy link

Same issue on Chromecast google tv

@e10kstarfire
Copy link

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-
Copy link

foss- commented Jan 22, 2023

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
Copy link

exaveal commented Jan 22, 2023

LineageOS 19 / Android 12 is working fine

@AlexKalopsia
Copy link

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

@foss-
Copy link

foss- commented Sep 16, 2023

If the issue indeed was fixed in Android 13, the fact it is reproducible with Android 12 would be very much expected.

Another data point:
ArrowOS 13.1
Jellyfin-Android 2.5.3
no repro

@libook
Copy link

libook commented Oct 9, 2023

To those who use jellyfin to listen to music: look for jellyfin music clients developed by third parties such as finamp.

@JHubi1
Copy link

JHubi1 commented Oct 11, 2023

Hi, so I had the same problem on my Pixel 6 with Android 14. I solved it by going into the app settings of Jellyfin and disabling the battery optimization. That worked for me.

@libook
Copy link

libook commented Oct 11, 2023

Hi, so I had the same problem on my Pixel 6 with Android 14. I solved it by going into the app settings of Jellyfin and disabling the battery optimization. That worked for me.

Doesn't work for me.
I am using Samsung Galaxy S21. Disabled battery optimization and added Jellyfin to the whitelist of RAM cleaner. Even locked Jellyfin from the Multi-tasking List(yes, Samsung provided this function for preventing apps be killed). None of them worked.

I have to agree that what I'm facing is what Maxr1998 said, it seems be a problem with some kind of webview.

@mm1ck
Copy link

mm1ck commented Dec 15, 2023

Sony Xperia 1
Android 11
JF app 2.6.0

I use this to stream my music while in the car.
Once connected it streams great until I close the screen, then I get a stuttery mess.
Tried making the background battery unoptimised for the app with no difference.

But, If I open JF in firefox I dont have a problem even when the screen closes.

@unarj
Copy link

unarj commented Dec 30, 2023

I was able to work around this issue on an S21U by changing the media player to "External" and keeping the app in memory (bring up the recent app list, tap on the Jellyfin logo at the top of the app window, and selecting "Keep Open")

@MaverickPOL
Copy link

On my Galaxy S21 app stop playing music when she is in background.
I try to add it to "do not kill list" but Jellyfin is not on list of apps there. Maby there is some problem with permisions?

@geriko2000
Copy link

geriko2000 commented Mar 9, 2024

Samsung S23U, latest android. Same issue

Author, please, add ability to play music in integrated player. Video works well, but music..

@Korvox
Copy link

Korvox commented Mar 9, 2024

Author, please, add ability to play music in integrated player. Video works well, but music..

Its inappropriate to ask volunteers writing open source software for free to do work for you, for free. There are platforms to support bounties to fix issues like this where people who don't want to do it in their free time for their own sake can instead get paid to do such work that other people want done. As with all FOSS, you gotta either do it yourself or pay someone to do it, just sideline complaining about issues just drives people away from contributing in the first place. This bug has been around for 4 years so obviously nobody has yet decided its worth their personal time to fix this, largely because its a huge architectural problem with how webview apps on Android work and would actually take a ton of effort to correct. Thank you Jellyfin team for all the hard work you do to make such a valuable service free to me.

@aman207
Copy link

aman207 commented Mar 9, 2024

I've been able to mitigate these problems by using Firefox instead of the app.

@JHubi1
Copy link

JHubi1 commented Mar 10, 2024

I mainly switched to Finamp, it works fine

@geriko2000
Copy link

Author, please, add ability to play music in integrated player. Video works well, but music..

Its inappropriate to ask volunteers writing open source software for free to do work for you, for free. There are platforms to support bounties to fix issues like this where people who don't want to do it in their free time for their own sake can instead get paid to do such work that other people want done. As with all FOSS, you gotta either do it yourself or pay someone to do it, just sideline complaining about issues just drives people away from contributing in the first place. This bug has been around for 4 years so obviously nobody has yet decided its worth their personal time to fix this, largely because its a huge architectural problem with how webview apps on Android work and would actually take a ton of effort to correct. Thank you Jellyfin team for all the hard work you do to make such a valuable service free to me.

If I could pay the developers to add this, I would

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Confirmed bug reports that shouldn't go stale upstream An issue that is not related to the app, but an upstream component (dependency, backend, web UI) wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests