Android App Music Playback stops after 2 songs (metadata hang)

@newplexuser59842 So your issue is just pausing playback, then coming back to the app after a while and the resume button doesn’t work?

Not to hijack this thread but it does seem a lot of these issues although somehow slightly different are all quite related. Android devices having trouble with reliable background (or screen off) playback.

I don’t have a samsung device. Oneplus 5T running oxygenos.

I understand some users get some relief by switching battery optimization settings or using plexamp instead…but this does not resolve the problem for everyone… so in these cases I would describe it as “working around” the problem rather than solving it. If we have to manually turn off battery optimization for the plex app to work then that is a work-around not a solution…and as I said that doesn’t solve it for all users.

This may not be the same for everyone but if there are multiple related problems here…the more we can fix, the more we can focus on finding/fixing whatever problems are remaining. It is hard for me to say for the others whether the 2-LAN problem I mentioned earlier is a common factor.

And in an earlier post I have debug logs from android side showing network errors happening when this problem occurred.

In that post I explain something that may not be obvious on first glance…that plex client (android) is trying to connect to the private plex server ip (lan ip) on a different LAN (unreachable). Either DNS caching issue or plex bug where under certain circumstances it tries to connect on private lan IP (wrong lan) rather than using the public internet IP/port of the remote (because I’m at work on LAN there) plex server.

It could be as dumb as the code saying: always try direct-connect to private IP first with short timeout and if that fails, try the public ip…and forgetting the second step in that logic somewhere in the android code. But the fact that starting streaming playback works fine at first and only later does the network error occur… dunno. If you want to share the android code, I’ll sign an NDA and take a look. :smiley:

So that is a very concrete/specific detail that is obviously broken that your engineering team should look at because this should not be happening.

suspicions

The battery optimization setting seemed to help at first but the problem came back so I think that may have had some short-term impact…but ultimately may be a red herring with regards to the real underlying issue.

when I am at work (different LAN than home plex server)

I play “synced” music only on android. This plays fine for me in background on BOTH plex and plexamp.

If I try to play playlists or album direct from the home server (not synced media)… they play fine but usually stop within a song or two (both plex and plexamp).

My home internet is definitely not double NATed (cable modem in bridge mode with juniper SRX behind that). I have fixed port-forwarding to the plex server which has a fixed IP on the home private LAN.

I don’t know about the work internet but I am pretty sure it isn’t double natted because VOIP and video conferencing and stuff would likely be broken. And their setup is very simple. Fritz box cable modem/router/wlan all-in-one box.

PlexAmp on macOS doesn’t have any problem streaming music from plex server when I am at work. So this does seem to be an android specific issue.

when I am at home (same LAN as plex media server)

I don’t have any trouble with background music playing stopping in either plex or plexamp.


So I suspect this isn’t about android killing the app as much as the bug illustrated in the logs I posted earlier.

Perhaps other people that have this problem can try to make a mental note of whether they only have this problem when streaming from not-at-home (not on the same wlan/lan as the plex server).

The battery optimization is likely at the OS level. Not sure how Plex could fix these as we probably can’t override the OS.

That snippet shows an error but not what led up to it. Also can’t tell if that is the error when your playback stopped. There isn’t enough info to tell. We need the entire log to look.

As I said I think this is a red-herring. Other apps like spotify don’t have this problem fetching/playing music in the background. So I wouldn’t fixate on some android setting as that won’t result in this problem being resolved.

If it turns out that this is fundamentally an android problem that plex can’t solve (despite other android music apps not having this issue), then plex certainly can at least detect if this problem is present (ie plex being put in wrong bucket by android) and notify the user about corrective action.

As an example (random version of android)…this page has lots of examples including how to detect what energy saving bucket your app is being put into.

However as other music apps don’t have this problem on android (and I am not talking about some special google apps that get special treatment)… I wouldn’t be so quick to point the blame in android’s direction.

Network timeouts are very common and should be handled by any robust app. The fact there is a timeout stack trace in the logs indicates this isn’t being caught/handled in a user friendly way (e.g. “we couldn’t reach the plex server”). So at the very least, whether or not that stack trace has to do with this problem (it does) it warrants attention and indicates some “code smell”.

I was careful to clear the logs, reproduce the problem and only pulled out the relevant section since the problem (based on timestamps). So yes this is the problem section exactly during the interval where the problem occurred.

However I understand you may want more context about overall playback that might help you narrow this down in your codebase. Next time I am at the office I will reproduce this again and send a complete session log.

Of course I am happy to provide more logs. I hope you haven’t been silently waiting 2.5 months for more logs instead of just asking. :smiley:

Turning off the battery optimization has helped some users so it’s not a red herring. It just may not be the only cause, which is why we need more info (cough, logs, cough) to identify other potential causes.

The Plex app is technically a video app that also handles music. PlexAmp is a music app so if both apps have issues, it’s not a matter of how the app is classified.

If it is a timeout issue, then the problem that caused the timeout could have occurred several minutes before the error so yes we would need more of your logs to see the cause.

I wasn’t aware of this thread until now. I always ask for logs. If I had a nickel every time I ask…

BlockquoteServer Version#: 1.19.5.3112
Player Version#: 8.3.1
Player Hardware: Samsung Galaxy S10e, Android 10, One UI 2.1

I continue to encounter a problem where music playback via the Android app will stop after 2 tracks.
Here is a breakdown of what happens:

Play an album
Track 1 plays
Screen displays track title/metadata for Track 1
Track 1 finishes
Track 2 plays
Screen continues to display title/metadata for Track 1
Track 2 finishes
Playback stops while still displaying title/metadata for Track 1

If I skip forward at any time during/after Track 2’s playback, the metadata will update to Track 2 and continue playing.
(meaning I have to manually skip forward every track after that)
My only fix when this happens is to completely close the app, reopen and try again and hope it works better.

I am encountering this more often than not recently, which is why I am hoping someone knows of a fix for this, or maybe the dev team can look at it.
I’ve searched for other topics and found other users with the same issue, but never a solution.
I also have all battery optimization options turned off for the Plex app, as this sometimes causes issues on Samsung hardware.

It seems this is happening when I return to the app to resume the current playback queue.
However, it seems to NOT happen if I manually close the app when I am done with my initial listening session. Normally when I am done listening, I just swipe the playback controls out of my notification center. However if I do this followed by manually closing the app, I seem to not have any problems the next time I return to the app.
I am assuming this means that the problem is being caused by the way the app goes to sleep after not being used for a while.
I have all battery optimization settings turned OFF for Plex on my phone, as I know this can cause other playback problems with Plex that people seem to experience on Samsung and some Pixel or LG hardware, I think.
I am not sure if the Plex app is closing itself (putting itself to sleep?) after a period of not being used, or if the Samsung/Android system is closing the app after a while.
I turned battery optimize functions ON for Plex, just so that I could specifically set the option for “never put Plex to sleep” on, but it still seemed to occur.
So, after digging a little, I found that closing an app and the app being put to sleep are two different things (putting an app to sleep will even disable notifications and network checks, etc).
I am myself unable to determine if the playback error I am encountering is due to the Samsung/Android system closing Plex after a few hours of unuse, or if Plex closes itself to stop running in the background after a little while. But in either case, it seems the app being auto-closed after a while is what is causing this problem.
Manually closing the app after I am done listening to music seems to prevent this issue the next time I open the app, but it is a little tedious and annoying, since other music apps don’t need this extra attention.
Hopefully this info helps the dev team resolve this issue?
Or maybe it could be useful for anyone else having this problem.
(another note I’d like to add is that when I come back to the app to continue listening to music, the progress bar for the current track usually seems to remember my progress, but after I press play, it jumps back to the beginning of the track. This happens whether I manually close the app myself or not. May or may not be directly related to this issue, but wanted to share it as well)

I have two (annoying) methods for dealing with this issue:
Preventative: Manually fully closing the app after each session (not just swiping away play controls in the notification center, but actually closing the app itself.
(feel I should re-mention that I do not have to do this for any other music apps)
Reactive: If I failed to close the app after my last session the only way to get the playback working correctly again is to completely clear the current play queue and start over. (annoying as this will lose the place in a shuffled playlist)
Fully closing the app and restarting at this point also works, as mentioned by @jaredgoldsmith above.

@anon18523487 Here is a summary of the issue from the first-third posts of this thread from last summer.
I have sent logs to @jesusmc last fall if you would like to consult with him.

I thought it helped me but it was only temporary. It is a red herring in that is is perhaps solving or half solving or temporarily masking the underlying issue…but is not the root issue or solving the root issue. Spotify doesn’t require that we change battery optimization settings on android in order for it to work properly. You can “fix” a memory leak in your wlan router by rebooting it every night…but that isn’t really fixing the memory leak is it?

I wasn’t making any statement about whether it is a music or video app.
The point is: battery optimization setting changes aren’t required for spotify and other music apps to function properly in the background. So saying the following…

…(that it is android’s problem to fix and not plex’s problem) isn’t very helpful.

I’m happy to provide more logs next opportunity now that you have asked. Lots of people would love to see this issue fixed.

However at a minimum you can see there is a problem that Plex android app is trying to reach the plex server using a private lan IP. That would be like me trying to talk to you on your home computer at 192.168.0.? from my home network IP of 10.12.12.30 which is obviously not going to work since they are both private IP addresses on different subnets behind different firewalls on opposite sides of the public internet. Of course that request will time out.

I’ve also shared the anecdote that this doesn’t ever occur when I am on the same private LAN as the plex server (e.g. home WLAN). It only is a problem when I am away from home on mobile data or a different WLAN connection. This is pretty specific and consistent repro conditions. Combined with the hint about the private IP address issue from the logs and the source code I would think you could home in on the bug pretty quickly.

Anyway, as I said I will add more complete logs next time I am at the office or maybe I try to repro this using mobile data tomorrow.

There have been lots of changes and attempt to fix this issue so getting new recent logs would be best.

Downloaded Plexamp yesterday. I don’t seem to have the issue anymore. I didn’t even know Plexamp existed. Thanks!

1 Like

Hello! I too struggle with these playback issues, I’m using a Huawei P30 Pro… And these errors only come when I’m outside of my local network. Using the current Plex version.

Usually the playback would stop about 5-6 times per hour, usually in the middle of a song (I listen to albums) but sometimes between songs, like the next song just wont start.

Most of the times the playback continues when I unlock my phone and wait a moment. But every now and then I get the metadata issue. Playback is stopped and when I unlock my phone the song doesn’t continue, I need to start the song manually and it starts from the beginning. Then when the next time the playback stops, the metadata is showing the song I previously had to manually start and need to skip to the current song…

A third kind of error is when the playback stops and I unlock my phone and see an error message that the song can’t be played so I need to restart it again, but this is the rarest of these playback issues.

I tried turning off the battery optimization and at first I though it worked really well as about 30 min had passed without any playback stops, but then it stopped, but this time I had around 2 stops per hour, the next time 3 stops an hour and finally it creeped back to the usual 5-6 playback stops per hour.

Like others, I didn’t have this issue with Google Music, Youtube Music or Spotify…

(Also one thing to mention, sometimes if the playback stops and I’m in no position to unlock the phone, after like half an hour the playback would automatically start again for some reason, which was kinda weird…)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.