Jump to content

Issues with headphone controls


futuresushi
Go to solution Solved by andrewilley,

Recommended Posts

Hello!

I have been on the hunt for a new music player (was literally just using VLC on my phone lol) and grabbed Poweramp because it was supposedly good for actually recognizing Bluetooth headphone controls and I had some Android store credit. However, I found that when connecting my Bluetooth headphones, I can only seem to get start/stop to work and not the double/triple presses, even when I have the latter option explicitly selected. Currently, I have it off in the options because it also seems to make the start/stop slow to respond.

My app's support printout, phone model and headphone model are below the cut. Any ideas on how I can troubleshoot this are greatly appreciated, and I can try to provide any other information needed on request.

Spoiler

Version Info ======================
Build: Poweramp build-976-bundle-play full verified cached
Store: Play
Unlocker: build-308
Arch: 64
Skin: ActivityTheme_Black
Device: Google Pixel 3 blueline blueline blueline [arm64-v8a, armeabi-v7a, armeabi]
Installer: com.android.vending (38.4.20-29 [0] [PR] 582426792)
Android: 12 google/blueline/blueline:12/SP1A.210812.016.C2/8618562:user/release-keys en_CA

Headphones: Anker Soundbuds Curve

 

Screenshot_20231204-134354.png

Link to comment
Share on other sites

If I delay the second press too long, what I get is a pause and immediate restart, like there was a delay in processing a pause command but the follow-up command was immediately met. Here's my log with a couple of double and triple tap attempts

==================

14:01:50.395 BTReceiver headset event
connection BT=true am mode=0 SoundBuds Curve
==================
14:01:50.515 PlayerService onRoutingChanged
newDevice=bt oldDevice=speaker
==================
14:01:50.515 PlayerService reloadPipeline
 allowPlaying=true forceResume=false state after reload=2
==================
14:01:52.056 PlayerService reloadPipeline
 allowPlaying=true forceResume=false state after reload=2
==================
14:02:12.336 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60946904 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:12.338 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60946907 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:12.950 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver pausePlaying 
==================
14:02:13.392 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60947961 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:13.393 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60947962 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:13.411 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
14:02:15.768 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60950337 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:15.770 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60950339 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:16.377 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver pausePlaying 
==================
14:02:16.615 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60951184 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:16.617 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60951186 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:16.623 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 
==================
14:02:24.818 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60959387 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:24.820 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60959389 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:25.429 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver pausePlaying 
 
Link to comment
Share on other sites

If you leave too long a gap between the two button presses then yes they will be interpreted as two separate events. One second in your first example is far too long. The sequence should be similar to double-clicking on a computer mouse, so as quickly as you can reasonably do two fast clicks. Also, have you actually turned the option on now (it was off in your earlier screenshot)? 

image.png

Example Double Click (note the timings, which are shown as hh:mm:ss.millisecs, so the commencement of the second ACTION_DOWN event occurs in under ¼ second from the first event):

==================
09:04:01.946 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_DOWN name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241446105 sourcePak=android flags=0x8 playerState=1
==================
09:04:02.063 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_UP name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241446225 sourcePak=android flags=0x8 playerState=1
==================
09:04:02.150 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_DOWN name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241446312 sourcePak=android flags=0x8 playerState=1
==================
09:04:02.300 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_UP name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241446460 sourcePak=android flags=0x8 playerState=1
==================
09:04:02.948 PlayerService NEXT
from PSMediaButtonReceiver 

Example Triple-click:

==================
09:04:06.625 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_DOWN name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241450785 sourcePak=android flags=0x8 playerState=1
==================
09:04:06.736 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_UP name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241450899 sourcePak=android flags=0x8 playerState=1
==================
09:04:06.811 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_DOWN name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241450976 sourcePak=android flags=0x8 playerState=1
==================
09:04:06.904 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_UP name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241451070 sourcePak=android flags=0x8 playerState=1
==================
09:04:07.017 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_DOWN name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241451181 sourcePak=android flags=0x8 playerState=1
==================
09:04:07.136 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY_PAUSE ACTION_UP name=KTMicro KT USB Audio Consumer Control source=0x101 sources=0x4103 virt=false repeat=0 actionTime=241451301 sourcePak=android flags=0x8 playerState=1
==================
09:04:07.192 PlayerService PREVIOUS
from PSMediaButtonReceiver 

I used wired earbuds in the example, but the same should apply to wireless - as long at they are sending the events fast enough of course, and not doing any internal reinterpretation.

Andre

Link to comment
Share on other sites

I had both rapid double clicks and longer gaps in that example and yeah, I had enabled the setting previously disabled. Does my log suggest I WASN'T doing rapid presses? At that point I would think to blame my headphones, but I don't have another set I can test with right now.

Link to comment
Share on other sites

Looking at your log more closely, it seems that your BT device is changing the button code that it is sending each time you press the button, thus alternating between sending a KEYCODE_MEDIA_PAUSE and a KEYCODE_MEDIA_PLAY. This means PA will never detect a double-click, merely one PAUSE command shortly followed by a separate PLAY command:

==================
14:02:12.336 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60946904 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:12.338 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PAUSE ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60946907 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=1
==================
14:02:12.950 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver pausePlaying 
==================
14:02:13.392 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_UP name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60947961 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:13.393 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_MEDIA_PLAY ACTION_DOWN name=Virtual source=0x0 sources=0x301 virt=true repeat=0 actionTime=60947962 sourcePak=com.android.bluetooth isAvrcp  flags=0x0 playerState=2
==================
14:02:13.411 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying 

The time difference between the ACTION_DOWN event (i.e. start of the period where the button is depressed) and ACTION_UP (indicating that the button has been released again) are also impossibly short - in fact they arrive reversed in the second instance - so the device is clearly reinterpreting your clicks and sending its own version of the commands. Not sure whether there's any way to correct that, but maybe @maxmp could come up with some sort of workaround to reverse this behaviour?

Andre

Link to comment
Share on other sites

The headphones sending specific commands rather than the generalized button press would explain its activity with some other apps... But Poweramp DID seem to detect my headphones specifically? Unless that was just the generic name given over the initial Bluetooth connection which is possible.

Link to comment
Share on other sites

  • Solution

All Poweramp knows about connected devices is the name that is passed via Android's Bluetooth connection (same with USB DACs) which is displayed in the Audio Info log. You can also assign EQ presets based on that device name. But otherwise it's basically just a label, it doesn't do anything.

The headset seems to be keeping an internal status of whether it thinks there is music currently playing, and is thus sending a discrete PLAY or a PAUSE command based on that current status when you press the button. This would prevent double or triple clicks being detected by the music player app as they would need to be treated as separate buttons.

I've just checked the headset's online manual, and track changing functionality is meant to be achieved by long-pressing (at least 1 second) on the + and - buttons. Have you tried that? I would hope they should generate KEYCODE_MEDIA_NEXT and KEYCODE_MEDIA_PREVIOUS button events.

image.png

image.png

image.png

Andre

Link to comment
Share on other sites

... Well now I feel stupid! Indeed it uses its own control settings and those presses work fine, even with only the "single press" command enabled. Gonna have to get used to the timing of it, I keep just doing volume presses because they're too short.

Thanks so much!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...