Jump to content
ModernCB

Bluetooth ignoring pause command

Recommended Posts

When playing music via Bluetooth through my JVC car stereo, Poweramp ignores pause commands from the stereo. The stereo button is a single play/pause button that toggles playback. Pressing the button when music is paused causes it to play, but when playing it wont pause. When looking at the process bluetooth commands, the button press is recieved but the command from the psmediabuttonservice is ignored. All other bluetooth commands (back/next/call/play) work fine, and the play/pause toggle worked just fine until October. Samsung Galaxy A8, Android version 9, Poweramp build 853, JVC 820bt stereo (old). I imagine the problem is an update to how Poweramp handles bluetooth commands, but an update does more harm than good for me if it limits compatibility with my other equipment. 

 

Command log. 17.18.35.213 shows the ignore behavior.

==================
17:18:33.632 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468616414 A2dpOn  isAvrcp  playerState=1
==================
17:18:33.689 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468616473 A2dpOn  isAvrcp  playerState=1
==================
17:18:33.692 PlayerService RESUME
from PSMediaButtonReceiver IGNORED
==================
17:18:35.077 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468617859 A2dpOn  isAvrcp  playerState=1
==================
17:18:35.207 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468617990 A2dpOn  isAvrcp  playerState=1
==================
17:18:35.213 PlayerService RESUME
from PSMediaButtonReceiver IGNORED
==================
17:18:51.048 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PREVIOUS ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468633832 A2dpOn  isAvrcp  playerState=1
==================
17:18:51.136 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PREVIOUS ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468633917 A2dpOn  isAvrcp  playerState=1
==================
17:18:51.146 PlayerService PREVIOUS
from PSMediaButtonReceiver 
==================
17:18:53.249 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_NEXT ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468636033 A2dpOn  isAvrcp  playerState=1
==================
17:18:53.424 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_NEXT ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468636207 A2dpOn  isAvrcp  playerState=1
==================
17:18:53.495 PlayerService NEXT
from PSMediaButtonReceiver 
==================
17:19:00.303 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468643086 A2dpOn  isAvrcp  playerState=1
==================
17:19:00.500 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=468643284 A2dpOn  isAvrcp  playerState=1
==================
17:19:00.510 PlayerService RESUME
from PSMediaButtonReceiver IGNORED
==================
17:22:24.408 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
17:22:24.408 HeadsetPlugReceiver cmd_player_pause_playing
==================
17:22:24.651 BTReceiver headset event
disconnection BT=true am mode=0 JVC Unit no_keep_notif_on_dscn=false
==================
17:28:28.749 BTReceiver headset event
connection BT=true am mode=0 JVC Unit
==================
17:29:46.252 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
17:29:46.283 BTReceiver headset event
disconnection BT=true am mode=0 JVC Unit no_keep_notif_on_dscn=false
==================
17:51:29.743 BTReceiver headset event
connection BT=true am mode=0 JVC Unit
==================
17:57:44.213 BTReceiver headset event
disconnection BT=true am mode=0 JVC Unit no_keep_notif_on_dscn=false
==================
17:57:44.228 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
18:14:07.739 BTReceiver headset event
connection BT=true am mode=0 JVC Unit
==================
18:18:36.112 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=470211525 A2dpOn  isAvrcp  playerState=2
==================
18:18:36.439 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=470211855 A2dpOn  isAvrcp  playerState=2
==================
18:18:36.479 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
18:18:36.544 PlayerService RESUME
from PSMediaButtonReceiver IGNORED
==================
18:30:53.478 BTReceiver headset event
disconnection BT=true am mode=0 JVC Unit no_keep_notif_on_dscn=false
==================
18:30:53.478 BTReceiver cmd_player_pause_playing
==================
18:30:53.501 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
 

Share this post


Link to post
Share on other sites

Unfortunately your Bluetooth device is sending a KEYCODE_MEDIA_PLAY event, which is a specific command to start playback, not to pause it. To pause playback it should be sending KEYCODE_MEDIA_PAUSE, or if the event is intended to be a Play/Pause toggle function (which would appear to be the desired effect) then it should be sending KEYCODE_MEDIA_PLAY_PAUSE. See https://developer.android.com/reference/android/view/KeyEvent .

The only way I can think of to work-around this issue with your BT device (if you can't get the manufacturer to fix it) would be if Max could add an option in PA's BT Settings area to deliberately misinterpret any PLAY, PAUSE or PLAY_PAUSE events as toggles. It would need to be an option though, as otherwise it would break functionality for devices which are sending those commands correctly.

Andre

Share this post


Link to post
Share on other sites

Thanks Andre. I figured it was something along those lines, but am still scratching my head a bit why it worked previously and then stopped working overnight. None of the hardware involved changed, the bluetooth command from my stereo didn't change, but something changed in either how my phone's bluetooth command service, or Poweramp, processed the command. Seems like someone tried to fix something that wasn't broken (Android or PA devs), and in the process broke it for me.

Share this post


Link to post
Share on other sites
21 hours ago, luiramji said:

Take a look at this Modern CB.

That relates to headunits sending spurious commands (especially when initially connecting) which you can indeed tell Poweramp to ignore, But that won't help if the user wants their commands to be actioned, but the head-unit is sending the wrong command. 

Andre

Share this post


Link to post
Share on other sites

 playerState=1 means STATE_PLAYING. Poweramp can't pause in response to RESUME command as most devices out of there will behave incorrectly with Poweramp then.

This is why it's ignored.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...