Skip to content

How to customize media button handlers ? #12

Open

Description

@muhammadalkady

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.

Activity

  1. changed the title [-]How to customizing media button handlers ?[/-] [+]How to customize media button handlers ?[/+] on Dec 1, 2021
  2. ojw28 commented on Dec 2, 2021

    @ojw28
    Contributor

    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).

  3. self-assigned this
    on Dec 2, 2021
  4. muhammadalkady commented on Dec 3, 2021

    @muhammadalkady
    Author

    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.

  5. google-oss-bot commented on Dec 23, 2021

    @google-oss-bot
    Collaborator

    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!

  6. muhammadalkady commented on Dec 28, 2021

    @muhammadalkady
    Author

    Any updates on this issue?

  7. marcbaechinger commented on Jan 11, 2022

    @marcbaechinger
    Contributor

    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.

  8. added a commit that references this issue on Feb 20, 2024
  9. added a commit that references this issue on Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions