Plex/PlexAmp: Auto pause / resume not working on Sony WH-1000XM4

Hello!

I wrote an review on Google Play and was instructed to find support from the forums so here it goes.

I’ve come around with really annoying issue with my new Sony WH-1000XM4 headphones. They have a feature which automatically pauses the music when you take the headphones off and resumes when you put them back on. With Plex and Plexamp the feature doesn’t really work as it should. The music is sometimes paused when the headphones are taken off but never resumed when I put them back on. The most annoying thing is that if I pause the playback and then take the headphones off the music resumes! If I then put them back on the music pauses so it works in reverse basically. Maybe it’s Sony issue, but it seems to work on the other apps (Spotify, Tidal, Youtube) according to my tests.

Thanks!

Plex Version#: 8.21.1.27073
PlexAmp Version#: 3.5.0

I own the Apple AirPods Max, which have the same feature with play/pause…

It works as expected with Plexamp on iOS as well as on macOS.

You mentioned the Google Playstore, so I assume you are using Plexamp on an Android Device?

Just give it a try with iOS.

Thanks for the suggestion. Yeah, forgot to mention it’s on Android. iOS is not really an option for me.

My suggestion is to test the behavior with an iOS device to figure out if it works in such a setup.

If play/pause won’t work on iOS either, you know it’s most likely Headphone related…

1 Like

Thanks for coming here to write this up!

If you can reproduce the issue, please go to Settings > Advanced > Debugging > Share Debug Logs and do this right after you go through a take off headphones/put on headphones so we can see what the app is seeing.

Thanks!

2 Likes

Thanks @elan

It can be easily reproduced as it happens every time right after I have started the app. I have attached logs for both Plex and Plexamp. The logs were saved right after starting playback, I took the headphones off (playback was paused) and put them back on (playback was NOT resumed).

Please let me know if you need any more tests or logs.

Thanks!

Plexamp logs.zip (10.7 KB)
Plex for Android Logs.zip (171.5 KB)

Just tested on Plexamp for iOS and it works just fine so the problem is on Android only.

Great (and I expected that).
If you have the possibility, try this with an other Android Device with a different Android OS Version…

Unfortunately I couldn’t find another device to test on. I have tested on Samsung Galaxy S10+ and on Galaxy Tab S7+ and the same on both.

Sorry for the delay, we were busy getting the new release out :sweat_smile:

So I see the pause come in (127 = pause):

Aug 13, 2021 07:06:17.044 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 0).
Aug 13, 2021 07:06:17.045 [Javascript] INFO - [MediaSessionCallback] onPlayPause
Aug 13, 2021 07:06:17.051 [0x9e7b2cc0] INFO - BASS: Pause.
Aug 13, 2021 07:06:17.086 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 1).

The two media button logs represent push and release of the button (down ⇢ up).

After this in the log, there are zero events related to buttons, so I’m rather confused.

1 Like

No worries, I rather take a new release than have a quick fix to this so it’s fine :slight_smile:

Strange. I have noticed that the resume works as long as I immediately put the headphones back on and in this case the log shows media button 126 (resume?) as well as 127. Anything more than a few second delay causes it to not work.

Sep 09, 2021 09:29:14.177 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 0).
Sep 09, 2021 09:29:14.177 [Javascript] INFO - [MediaSessionCallback] onPlayPause
Sep 09, 2021 09:29:14.182 [0xb1432cc0] INFO - BASS: Pause.
Sep 09, 2021 09:29:14.182 [0xb1432cc0] INFO - BASS: Pausing stream 80245 with fade, kill: 0
Sep 09, 2021 09:29:14.195 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 1).
Sep 09, 2021 09:29:14.200 [Javascript] INFO - Audio: State changed from playing to paused.
Sep 09, 2021 09:29:14.200 [Javascript] INFO - PlayQueue: Saving state {"source":"f01b6fe145f286175de010f49939ff742541c0db","state":"paused","time":47738,"rate":1,"volume":100,"playQueueID":"2530","playQueueVersion":1,"playQueueItemID":"80245"}
Sep 09, 2021 09:29:14.200 [Javascript] DEBUG - PlayQueue: Processing send timelines in state paused time 47738.
Sep 09, 2021 09:29:14.200 [Javascript] INFO - ViewState: Progress 26% (47738 ms) on item f01b6fe145f286175de010f49939ff742541c0db/62480.
Sep 09, 2021 09:29:14.201 [Javascript] INFO - ViewState: Trying to send directly.
Sep 09, 2021 09:29:14.202 [Javascript] INFO - Player: Sending state changed [A] Song (47738/182987) in state paused with artwork true.
Sep 09, 2021 09:29:14.203 [Javascript] DEBUG - [Metadata] building metadata for: (Song)
Sep 09, 2021 09:29:14.203 [Javascript] DEBUG - [PlayerModule] Got state event paused (local: true).
Sep 09, 2021 09:29:14.228 [Javascript] DEBUG - [PlayerService] Got player data in state paused.
Sep 09, 2021 09:29:14.229 [Javascript] DEBUG - [PlayerService] Building playback notification with state (Paused).
Sep 09, 2021 09:29:14.233 [Javascript] INFO - [MediaSessionDelegate] Setting playback position to 47738 speed 1,0 state Paused.
Sep 09, 2021 09:29:14.246 [Javascript] INFO - [PlayerIntentHelper] Sending state changed action with state paused
Sep 09, 2021 09:29:14.246 [Javascript] INFO - [PlayerService] Action com.plexamp.ACTION_STATE_CHANGED
Sep 09, 2021 09:29:14.246 [Javascript] INFO - [PlayerService] Player state moved to paused (has focus: true).
Sep 09, 2021 09:29:14.246 [Javascript] DEBUG - [AudioFocus][API26] Attempting to abandon audio focus.
Sep 09, 2021 09:29:14.247 [Javascript] DEBUG - [AudioFocus] Abandoned Audio Focus, success: 1
Sep 09, 2021 09:29:14.247 [Javascript] DEBUG - [PlayerService] Playback stopped, demoting to background service.
Sep 09, 2021 09:29:14.247 [Javascript] DEBUG - [PlayerService] Clearing state.
Sep 09, 2021 09:29:14.475 [0xbbb23cc0] DEBUG - Networking: Completed request 67: (GET https://xxxx&X-Plex-Device-Name=Android) with code 200 (have 106 bytes) in 227 ms.
Sep 09, 2021 09:29:14.478 [Javascript] INFO - ViewState: Server reports playback state ignore.
Sep 09, 2021 09:29:14.683 [0x2a2f1cc0] INFO - BASS: Stream 80245 is paused.
Sep 09, 2021 09:29:15.321 [Javascript] DEBUG - [PlayerService] Got a media button 126 (action: 0).
Sep 09, 2021 09:29:15.322 [Javascript] INFO - [MediaSessionCallback] onPlayPause
Sep 09, 2021 09:29:15.336 [Javascript] DEBUG - [PlayerService] Got a media button 126 (action: 1).
Sep 09, 2021 09:29:15.337 [0xb1432cc0] INFO - BASS: Resume.
Sep 09, 2021 09:29:15.337 [0xb1432cc0] DEBUG - BASS: Taking mixer pause flag off channel.
Sep 09, 2021 09:29:15.337 [0xb1432cc0] DEBUG - BASS: Fading in stream.
Sep 09, 2021 09:29:15.337 [0xb1432cc0] INFO - BASS: Resuming with fade.
Sep 09, 2021 09:29:15.337 [0xb1432cc0] INFO - BASS: Resuming audio output (started: 1)
Sep 09, 2021 09:29:15.343 [0xb1432cc0] INFO - BASS: We're gaplessly connecting the two streams.
Sep 09, 2021 09:29:15.343 [0xb1432cc0] DEBUG - BASS: Sliding volume to 100 over 500 ms.
Sep 09, 2021 09:29:15.352 [Javascript] INFO - Audio: State changed from paused to playing.

Here’s also the log from the case where I paused the music, took the headphones off and the music automatically resumes. It seems to get button 127 which I take should not resume?

Manual pause:
Sep 09, 2021 09:49:32.307 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 0).
Sep 09, 2021 09:49:32.360 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 1).
Sep 09, 2021 09:49:32.363 [Javascript] DEBUG - [PlayerService] Got player data in state paused.

Took headphones off:
Sep 09, 2021 09:49:38.970 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 0).
Sep 09, 2021 09:49:38.970 [Javascript] INFO - [MediaSessionCallback] onPlayPause
Sep 09, 2021 09:49:38.978 [0xb1432cc0] INFO - BASS: Resume.
Sep 09, 2021 09:49:38.979 [0xb1432cc0] DEBUG - BASS: Taking mixer pause flag off channel.
Sep 09, 2021 09:49:38.979 [0xb1432cc0] DEBUG - BASS: Fading in stream.
Sep 09, 2021 09:49:38.979 [0xb1432cc0] INFO - BASS: Resuming with fade.
Sep 09, 2021 09:49:38.979 [0xb1432cc0] INFO - BASS: Resuming audio output (started: 1)
Sep 09, 2021 09:49:38.985 [0xb1432cc0] INFO - BASS: We're gaplessly connecting the two streams.
Sep 09, 2021 09:49:38.985 [0xb1432cc0] DEBUG - BASS: Sliding volume to 100 over 500 ms.
Sep 09, 2021 09:49:38.990 [Javascript] INFO - Audio: State changed from paused to playing.
Sep 09, 2021 09:49:38.990 [Javascript] INFO - PlayQueue: Saving state {"source":"f01b6fe145f286175de010f49939ff742541c0db","state":"playing","time":9484,"rate":1,"volume":100,"playQueueID":"2530","playQueueVersion":3,"playQueueItemID":"80249"}
Sep 09, 2021 09:49:38.991 [Javascript] DEBUG - PlayQueue: Processing send timelines in state playing time 9484.
Sep 09, 2021 09:49:38.991 [Javascript] INFO - ViewState: Progress 4% (9484 ms) on item f01b6fe145f286175de010f49939ff742541c0db/62484.
Sep 09, 2021 09:49:38.991 [Javascript] INFO - ViewState: Trying to send directly.
Sep 09, 2021 09:49:38.995 [Javascript] INFO - Player: Sending state changed [A] Song2 (9484/200803) in state playing with artwork true.
Sep 09, 2021 09:49:38.997 [Javascript] DEBUG - [Metadata] building metadata for: (Song2)
Sep 09, 2021 09:49:38.999 [Javascript] DEBUG - [PlayerModule] Got state event playing (local: true).
Sep 09, 2021 09:49:39.027 [Javascript] DEBUG - [PlayerService] Got player data in state playing.
Sep 09, 2021 09:49:39.027 [Javascript] DEBUG - [PlayerService] Building playback notification with state (Playing).
Sep 09, 2021 09:49:39.028 [Javascript] DEBUG - [PlayerService] Got a media button 127 (action: 1).

I realize this is not much to work with so no worries if this is unsolvable.

Yeah, 126 is KeyEvent.KEYCODE_MEDIA_PLAY.

Ah, interesting, this might be related to our handling of those key-codes. Historically we’ve seen some weird behavior coming in with those codes, so we actually treat play and pause as “play/pause” (toggling actions).

If you’d be willing to try some APKs, DM me and we can see if we can improve the behavior.

1 Like

Awesome! DM sent.

Any news on this @elan? I’ve been using the test APK since you sent it and it’s great although the resume still does not quite work but the auto pause works perfectly. I’d just rather use the official build :wink:

The fix will be in 3.8.0 which we’re in the process of getting to the store.

Thank you, that’s really awesome! :sunglasses:

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