How to customize media button handlers ?
I can't customize media button handlers. I should be able to override onMediaButtonEvent, also onStartCommand called with intent with null action when pressing on media button from [bluetooth headset]. It is called after the media is played or paused so there is no chance to customize buttons behavior.
It's very unclear what this issue is referring to, in part due to a lack of context. Please could you fully explain your use case (e.g., what customisation are you trying to make).
I am trying to make the media always rebuffer when the user hits the play button as the stream is alive.
In MediaLibraryService when onStartCommand is called I can extract the keyCode like this
val keyCode = intent?.extras?.getParcelable<KeyEvent>(EXTRA_KEY_EVENT) so I can handle the KEYCODE_MEDIA_PLAY and it is working when receiving click from media notification, but when receiving the click from Bluetooth headset the player resumes the media after that onStartCommand is called with null extras
val keyCode = intent?.extras?.getParcelable<KeyEvent>(EXTRA_KEY_EVENT) // keyCode = null.
Here in MediaSessionCompat I can customize the media handlers. So how to do this is in androidx.media3.session.MediaSession
Thanks.
Hey @muhammadalkady. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Any updates on this issue?
AndroidX Media3 is still in alpha. Your feedback is valuable to us. There are some changes coming in regarding how media key events are handled. I will update this issue when this is the case to make you aware and that we know whether your case is covered.