-
Notifications
You must be signed in to change notification settings - Fork 404
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
KEYCODE_HEADSETHOOK and double click behaviour #1493
Comments
Thanks for reporting - it looks like I also noticed our code seems to consider media/libraries/session/src/main/java/androidx/media3/session/MediaSessionImpl.java Lines 1252 to 1253 in be2d68c
I've sent a change to make all 3 places handle all 3 of:
|
As reported in Issue: #1493 we already use `HEADSETHOOK` to start waiting for a double-tap, but we don't consider it for the second tap. Similarly, we previously considered `PLAY` for the second tap, but not the first. Only `HEADSETHOOK` and `PLAY_PAUSE` are [documented](https://developer.android.com/reference/androidx/media3/session/MediaSession#media-key-events-mapping) to transform double-tap to `seekToNext`. So this change removes the `PLAY` detection from the second tap. #cherrypick PiperOrigin-RevId: 651017522
After a bit of back and forth in review, I dropped the handling of |
As reported in Issue: #1493 we already use `HEADSETHOOK` to start waiting for a double-tap, but we don't consider it for the second tap. Similarly, we previously considered `PLAY` for the second tap, but not the first. Only `HEADSETHOOK` and `PLAY_PAUSE` are [documented](https://developer.android.com/reference/androidx/media3/session/MediaSession#media-key-events-mapping) to transform double-tap to `seekToNext`. So this change removes the `PLAY` detection from the second tap. PiperOrigin-RevId: 651017522 (cherry picked from commit c64dacf)
Version
Media3 main branch
More version details
No response
Devices that reproduce the issue
Devices that have a headset attached to them and send
KEYCODE_HEADSETHOOK
when clicking on the headsets primary button.Concrete error device:
OPPO CPH1951
.Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
On all devices, the issue can be reproduced by sending the keycode for
KEYCODE_HEADSETHOOK
twice (replicating a double tap) over ADB.We took a look at the code, and can see why there is an issue. At this stage, we are testing for PLAY_PAUSE and HEADSETHOOK. It then sets a handler to fire to detect a double tap. Once the next tap comes through, the double tap flag is set.
After the flag is set, it will be checked either here or here. Unfortunately, neither cases take KEYCODE_HEADSETHOOK into account. This leads to next media not being set.
Expected result
The system converts to a seek to next.
Actual result
The system makes a play / pause.
Media
Any
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: