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

Feature request: respond to KEYCODE_MEDIA* media buttons #607

Closed
sudomain opened this issue Apr 25, 2021 · 3 comments
Closed

Feature request: respond to KEYCODE_MEDIA* media buttons #607

sudomain opened this issue Apr 25, 2021 · 3 comments
Labels
always-fresh Issues that will never become stale bug Something isn't working priority/medium

Comments

@sudomain
Copy link

Is your feature request related to a problem? Please describe.

Please have the app respond to media buttons such as
KEYCODE_MEDIA_STOP, KEYCODE_MEDIA_PLAY, and KEYCODE_MEDIA_PLAY_PAUSE so that sounds can be affected by hardware media buttons.
https://developer.android.com/guide/topics/media-apps/mediabuttons

Describe the solution you'd like

Play, pause, stop, and play/pause toggle via media buttons please. Another idea could be KEYCODE_MEDIA_NEXT and KEYCODE_MEDIA_PREVIOUS to cycle through the saved presets.

@sudomain sudomain added the enhancement New feature or request label Apr 25, 2021
@ashutoshgngwr ashutoshgngwr added always-fresh Issues that will never become stale priority/medium labels Apr 26, 2021
@ashutoshgngwr
Copy link
Member

ashutoshgngwr commented Apr 26, 2021

And you'd think that media session callbacks will handle that for you. I am really starting to hate how Android is turning out to be lately.

https://github.com/ashutoshgngwr/noice/blob/8da55e749f37b985110dcd5eecbc7132ae0aa356/app/src/main/java/com/github/ashutoshgngwr/noice/sound/player/PlayerManager.kt#L75-L91


Edit

What exactly is the purpose of Media Session callbacks then? It doesn't seem to handle media buttons.

https://developer.android.com/reference/kotlin/android/support/v4/media/session/MediaSessionCompat.Callback


Wow! I am bamboozled.

https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Callback#onMediaButtonEvent(android.content.Intent)


Found the issue. Mistakenly used bitwise AND instead of OR. Right now, I have a lot of uncommitted changes in my working tree. Will fix this ASAP.

https://github.com/ashutoshgngwr/noice/blob/8da55e749f37b985110dcd5eecbc7132ae0aa356/app/src/main/java/com/github/ashutoshgngwr/noice/sound/player/PlayerManager.kt#L68-L73

@ashutoshgngwr ashutoshgngwr added bug Something isn't working and removed enhancement New feature or request labels Apr 26, 2021
@sudomain
Copy link
Author

Thank you for the quick response on this and the other issue. What is your opinion on KEYCODE_MEDIA_NEXT and KEYCODE_MEDIA_PREVIOUS to cycle through the saved presets?

@ashutoshgngwr
Copy link
Member

@sudomain I'll be working on that among other things. I was going to add media player style notifications, but that requires some code restructuring before implementation. These media buttons should be partially implemented during the notification implementation. Nevertheless, it'll all be available in the next release.

ashutoshgngwr added a commit that referenced this issue May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
always-fresh Issues that will never become stale bug Something isn't working priority/medium
Projects
None yet
Development

No branches or pull requests

2 participants