Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

how receive Bluetooth headset control cmd? #147

Open
gateshibill opened this issue Jan 20, 2021 · 8 comments
Open

how receive Bluetooth headset control cmd? #147

gateshibill opened this issue Jan 20, 2021 · 8 comments

Comments

@gateshibill
Copy link

the phone is connected Bluetooth headset,headset can play and pause,but i don't kown audioplayer how to work

@gateshibill
Copy link
Author

I hava the same question,
other player can receice bluetooth cmd.

@moda20
Copy link

moda20 commented Dec 20, 2021

For bluetooth commands and any other media commands ( controllers, wire headphones, ...) you can check my fork of this library. https://github.com/moda20/audioplayer
It is outdated a little bit compared to this one especially for the iOS side, but for android the command listeners are well implemented.

@gateshibill
Copy link
Author

For bluetooth commands and any other media commands ( controllers, wire headphones, ...) you can check my fork of this library. https://github.com/moda20/audioplayer It is outdated a little bit compared to this one especially for the iOS side, but for android the command listeners are well implemented.

thank moda20,
you provide audioplayer is different to rxlabz/audioplayer,it has no the audioPlayer.onPlaybackKeyEvent().
if I use your audioplayer ,will I do more code to adapt it?

@moda20
Copy link

moda20 commented Dec 20, 2021

it has onPlaybackKeyEvent. check the docs on the repo. my version shouldn't be much different from this repo.

@gateshibill
Copy link
Author

rxlabz/audioplayer doesn't have onPlaybackKeyEvent,

@gateshibill
Copy link
Author

it has onPlaybackKeyEvent. check the docs on the repo. my version shouldn't be much different from this repo.
moda20/audioplayer is very good,has the onPlaybackKeyEvent.
i am using it instead of rxlabz/audioplayer.
i don't know it whether include all featrues rxlabz/audioplayer has.

@gateshibill
Copy link
Author

W/Choreographer(15953): Frame time is 17.409424 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
W/Choreographer(15953): Frame time is 16.27997 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
D/ViewRootImpl(15953): DisplayId = 0
I/MediaBrowserService(15953): No root for client com.android.bluetooth from service android.service.media.MediaBrowserService$ServiceBinder$1
D/AndroidRuntime(15953): Shutting down VM
E/AndroidRuntime(15953): FATAL EXCEPTION: main
E/AndroidRuntime(15953): Process: com.freejoy.music, PID: 15953
E/AndroidRuntime(15953): java.lang.RuntimeException: Unable to stop service bz.rxla.audioplayer.AudioplayerPlugin@40c9b0d: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.session.MediaSession.release()' on a null object reference
E/AndroidRuntime(15953): at android.app.ActivityThread.handleStopService(ActivityThread.java:4048)
E/AndroidRuntime(15953): at android.app.ActivityThread.access$1900(ActivityThread.java:233)
E/AndroidRuntime(15953): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
E/AndroidRuntime(15953): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15953): at android.os.Looper.loop(Looper.java:233)
E/AndroidRuntime(15953): at android.app.ActivityThread.main(ActivityThread.java:7225)
E/AndroidRuntime(15953): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15953): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
E/AndroidRuntime(15953): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
E/AndroidRuntime(15953): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.session.MediaSession.release()' on a null object reference
E/AndroidRuntime(15953): at bz.rxla.audioplayer.AudioplayerPlugin.onDestroy(AudioplayerPlugin.java:199)
E/AndroidRuntime(15953): at android.app.ActivityThread.handleStopService(ActivityThread.java:4028)
E/AndroidRuntime(15953): ... 8 more
I/Process (15953): Sending signal. PID: 15953 SIG: 9
Lost connection to device.

@gateshibill
Copy link
Author

it has onPlaybackKeyEvent. check the docs on the repo. my version shouldn't be much different from this repo.

with moda20/audioplayer ,app collapse when the Bluetooth switch of the mobile phone is switched,from close to open.
if with rxlabz/audioplayer,it it normal.

log as the following:
W/Choreographer(15953): Frame time is 17.409424 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
W/Choreographer(15953): Frame time is 16.27997 ms in the future! Check that graphics HAL is generating vsync timestamps using the correct timebase.
D/ViewRootImpl(15953): DisplayId = 0
I/MediaBrowserService(15953): No root for client com.android.bluetooth from service android.service.media.MediaBrowserService$ServiceBinder$1
D/AndroidRuntime(15953): Shutting down VM
E/AndroidRuntime(15953): FATAL EXCEPTION: main
E/AndroidRuntime(15953): Process: com.freejoy.music, PID: 15953
E/AndroidRuntime(15953): java.lang.RuntimeException: Unable to stop service bz.rxla.audioplayer.AudioplayerPlugin@40c9b0d: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.session.MediaSession.release()' on a null object reference
E/AndroidRuntime(15953): at android.app.ActivityThread.handleStopService(ActivityThread.java:4048)
E/AndroidRuntime(15953): at android.app.ActivityThread.access$1900(ActivityThread.java:233)
E/AndroidRuntime(15953): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
E/AndroidRuntime(15953): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(15953): at android.os.Looper.loop(Looper.java:233)
E/AndroidRuntime(15953): at android.app.ActivityThread.main(ActivityThread.java:7225)
E/AndroidRuntime(15953): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15953): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
E/AndroidRuntime(15953): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
E/AndroidRuntime(15953): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.session.MediaSession.release()' on a null object reference
E/AndroidRuntime(15953): at bz.rxla.audioplayer.AudioplayerPlugin.onDestroy(AudioplayerPlugin.java:199)
E/AndroidRuntime(15953): at android.app.ActivityThread.handleStopService(ActivityThread.java:4028)
E/AndroidRuntime(15953): ... 8 more
I/Process (15953): Sending signal. PID: 15953 SIG: 9
Lost connection to device.

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

No branches or pull requests

2 participants