Resume Playback at Startup - Media Session?

I’m using an Android head unit add-on in my car to stream music in Plexamp. The overall app usability is really nice, but I’ve noticed the music will not continue automatically after starting the car if I shut my car down with the Maps app up. This works normally with XM and other radio station apps. If Plexamp is the last app I have on the screen before shutting down, it continues like the other apps at startup.

I asked the vendor of my head unit (Grom Audio) and they asked me to reach out to you guys about the Media Session implementation in the app, as their unit pulls that data during startup to continue the audio playback. I’m not sure what that means, but I can pull logs and that sort of thing if that helps.

can they be a bit more specific about what they need? happy to correspond directly with someone there.

I’m checking with them now to see if they have a direct way to contact a member of their team so you guys can collaborate. Will let you know.

And hopefully my description of the issue makes sense, it’s kinda difficult to explain.

it does make sense, just … mysterious :slight_smile:

Welp, it sounds like they don’t want to collaborate for some reason… They just dodged my question to see if you could reach out to them directly and gave me a link, stating "Media Session is a standard feature Android.
Here is the way it should work (and how we expect it to work):

https://developer.android.com/guide/topics/media-apps/working-with-a-media-session"

For what it’s worth, I really don’t like their response and I applaud your willingness to work with them directly. I wish they’d be more helpful.

I kept trying to see if they would be willing to help out this and they ended up just closing my ticket. What am unhelpful pile of ■■■■ they are with their non-answers… I noticed Plexamp will crash too when the unit starts up from a no-power state. If you guys want me to collect some logs for more info, I’m willing to help with that.

i don’t see any crashes from this username in our system, it would be helpful to see some logcats with the crash if you can get that.

I was able to grab the debug logs from Plexamp, but I’m not sure how useful they’ll be. Still trying to figure out how to get system logs from the unit itself. I can do the “send feedback” when it pops up, but it doesn’t give me an option to export that data.

unfortunately the debug logs from Plexamp wouldn’t include crash information.

and just to clarify, your username on plex (that you’re signing into Plexamp with) is willn2e, right?

I always log into Plexamp/Plex using the email address that’s tied to this account. I’ve never used “willn2e” as a username to log in, so I’m not sure.

ah thanks, looked up your crashes :+1:

it’s a weird one we’ve seen in the past, but been unable to reproduce reliably. would actually like to see a Plexamp log which goes along with the crash, and if you can reproduce it 100% it might be interesting to pass you a few APKs over to get more data from.

Yes, I can recreate the issue reliably. Seems like it always occurs after the head unit cold boots when Plexamp was the last used media player. I’ve cold booted it about three times in the last 10 minutes or so and it crashed each time. I also still have the Plexamp logs I grabbed earlier today after it crashed.

After needing to reboot my phone yesterday, I noticed Plexamp is doing “something” during my phone startup (I get a notification that says Plexamp is running that disappears shortly after). Makes me wonder if that’s what Plexamp is trying to do when my head unit boots but crashes instead.

As for the original issue… I’ve been looking through the logs and noticed these few lines seemingly every time after playback is paused when I shut down the car without the app running in foreground:
[PlayerService] Got player data in state paused.
[PlayerService] Building playback notification with state (Paused).
[PlayerService] Destroy.
[MediaSessionDelegate] Destroying
[PlayerService] Creating.
[MediaSessionDelegate] Initializing.

When the app is kept in the foreground and it resumes playback automatically, I see these types of entries in the logs:
[PlayerService] Got player data in state paused.
[PlayerService] Building playback notification with state (Paused).
[MediaSessionDelegate] Setting playback position to 202404 speed 1.0 state Paused.
[PlayerService] Sending state changed action with state paused
[PlayerService] Got player data in state playing.
[PlayerService] Building playback notification with state (Playing).
[MediaSessionDelegate] Setting playback position to 203114 speed 1.0 state Playing.

At least to me, it looks like Plexamp is destroying the media session when the head unit goes into sleep state, but only when the app isn’t running in the foreground. The head unit then doesn’t have a session to pick up anymore when it leaves sleep and needs to initialize a new one when I manually re-open the app and start playback.

Feel free to PM me, we can play with APKs and see if we can figure out how to avoid the crash.

I think that is correct :thinking: Per last message, DM me and maybe you can try out some new APKs.

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