Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App ignores commands from headset #111

Closed
keddad opened this issue Jan 11, 2020 · 22 comments
Closed

App ignores commands from headset #111

keddad opened this issue Jan 11, 2020 · 22 comments

Comments

@keddad
Copy link
Contributor

keddad commented Jan 11, 2020

Hi! I'm running version 4.0.1 from F - Droid on Android 9. Player works very well, and I love it, but I faced an issue: app ignores commands from headphones like pause or previous/next track. But it is definitely not headphones issue: they work well with other players. What logs can I provide to help fixing this bug? The only thing I could find by myself were logs in LogCat about headphones button press, but they seem normal, so I guess these are not really helpful:

01-11 14:49:58.111 D/NewAvrcpNativeInterface(2280): sendMediaKeyEvent: keyEvent=76 pushed=true

@enricocid
Copy link
Owner

enricocid commented Jan 11, 2020

Hi, I'm gonna send you a test apk. :)

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

That would be great! Here they are:
70 - Pause
75 - Next Track
76 - Previous Track

@enricocid
Copy link
Owner

Do you resume playback too with pause button?

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

Yes

@enricocid
Copy link
Owner

I registered those key events here:

https://drive.google.com/open?id=12i7uOBCtCeiRMY3i8Z0QC42n8hIbfHjL

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

That's strange. I can see MediaKeyEvents in LogCat viewer, but the app still ignores them

@enricocid
Copy link
Owner

in the logcat you should find a output called "action". Could you post it here?

https://drive.google.com/open?id=1kBl7cHefGQAk0OSg_OPl9UTx3LSGzySp

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

I might be doing something wrong, but if I do

keddad@keddad-pc:~$ adb logcat -s "action"

I can see basically nothing:

keddad@keddad-pc:~$ adb logcat -s "action"
--------- beginning of system
--------- beginning of crash
--------- beginning of main

Logcat itself is file, adb logcat still works. If I press any buttons on the headphones, there are still nothing in the output of -s "action". If I just grep "Action", there are nothing useful too:

keddad@keddad-pc:~$ adb logcat | grep Action
01-11 17:27:56.740   883  1083 I ThermalEngine: j=0 i=0 TM Id SKIN-BATTERY-MONITOR Sensor xo_therm: Action battery value 0
01-11 17:28:02.751   883  1083 I ThermalEngine: j=0 i=0 TM Id SKIN-BATTERY-MONITOR Sensor xo_therm: Action battery value 0
01-11 17:29:15.845   883  1083 I ThermalEngine: j=0 i=0 TM Id SKIN-BATTERY-MONITOR Sensor xo_therm: Action battery value 0
01-11 17:30:51.956   883  1083 I ThermalEngine: j=0 i=0 TM Id SKIN-BATTERY-MONITOR Sensor xo_therm: Action battery value 0

If I grep "action" there are much more, but it is still useless. The only thing related to the buttons in the logs are still KeyEvents:

01-11 17:42:21.418 15865 15885 D NewAvrcpTargetJni: sendMediaKeyEvent
01-11 17:42:21.418 15865 15885 D NewAvrcpNativeInterface: sendMediaKeyEvent: keyEvent=70 pushed=false
01-11 17:42:21.418 15865 15885 D NewAvrcpTargetService: getMediaKeyEvent: event=70 pushed=false
01-11 17:42:21.418 15865 15885 D NewAvrcpMediaPlayerList: sendMediaKeyEvent: key=70 pushed=false

@enricocid
Copy link
Owner

enricocid commented Jan 11, 2020

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

Now I can go to next/previous track and pause the track, but I can't unpause it.

@enricocid
Copy link
Owner

Can you describe the buttons?

Do you have one button to manage play pause?

@keddad
Copy link
Contributor Author

keddad commented Jan 11, 2020

Yes

@enricocid
Copy link
Owner

@keddad
Copy link
Contributor Author

keddad commented Jan 12, 2020

Amazing, it is working! Thanks!

@enricocid
Copy link
Owner

Great, thanks!!

@enricocid
Copy link
Owner

Hi, sorry for the disturb but I need you to test this apk

https://drive.google.com/open?id=1fsvkv7dkm28lRCdWqq8q3dpilqaFZ7VJ

I'm trying to optimize the code for media buttons.
Could please let me know:

  • if the headsets buttons are still working properly
  • what happens when you stop playback/kill the service (stop the playback from the notification).

thanks

@keddad
Copy link
Contributor Author

keddad commented Jan 19, 2020

I`m afraid that this headset died couple of days ago :D Sorry for that

@enricocid
Copy link
Owner

enricocid commented Jan 19, 2020

noooooo, i'm sorry... my nexus 5 died yesterday because of swollen battery and I now have to use emulator...

No problem, there's an app in the sdk to help devs to test hardware controls.

https://drive.google.com/open?id=1kp0yVFDwwLeo5oF7eawTRdQqeeY6mciM

Could you please install this apk, then click on the 3 dots -> hardware controls and let me know if the buttons are working also for you (just to be sure) with the apk above? thanks

@keddad
Copy link
Contributor Author

keddad commented Jan 19, 2020 via email

@enricocid
Copy link
Owner

enricocid commented Jan 19, 2020

Thanks.
With the app closed/killed service, what happens if you use hardware controls (hopefully nothing)?

@keddad
Copy link
Contributor Author

keddad commented Jan 19, 2020 via email

@enricocid
Copy link
Owner

enricocid commented Jan 19, 2020

Well, nothing. It is probably intended behavior, right? Jan 19, 2020 19:43:27 enricocid [email protected]:

With the app closed/killed service, what happens if you use hardware controls? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [#111?email_source=notifications&email_token=AID4EL6KU2KNCBSQ22U4L43Q6R7K3A5CNFSM4KFRTRUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJKWTKI#issuecomment-576022953] , or unsubscribe [https:/notifications/unsubscribe-auth/AID4EL6QCCHENMKXUW7JFFLQ6R7K3ANCNFSM4KFRTRUA] . [https:/notifications/beacon/AID4EL6DCAYOX4ZXM6B3AP3Q6R7K3A5CNFSM4KFRTRUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJKWTKI.gif]

Yes, I want the app to respond to buttons only when opened or playback is active. The default behaviour of android os is to try to launch playback from the latest app connected to mediabrowserservice... since i've not implemented the full client the app crashes on certain devices so I had to ensure to disable this behaviour to avoid issues :) thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants