You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pressing Play/Pause button twice on remote devices triggers Command_Seek_To_Next #962
We're seeing the issue on devices with a Play/Pause button on their remote. The issue is pressing the Play/Pause twice is triggering the COMMAND_SEEK_TO_NEXT command inside Media3 MediaSession. Originally we created a workaround for this issue since this was a known bug: androidx/media#233. Our workaround is causing an issue on FireTV for the Next voice command so we are removing the workaround but notice this issue persists.
Our app is using Media3 version 1.1.1.
Any suggestions on how to prevent MediaSession from triggering COMMAND_SEEK_TO_NEXT when Play/Pause button is pressed twice?
Expected result
Pressing Play/Pause multiple times plays or pauses playback.
Sorry, for the confusion. When updating to version 1.2.0 our workaround was re-enabled so it appeared to be fixed but after removing the workaround we are seeing the issue in version 1.2.0 as well.
Starting from 1.2.0, MediaSession.Callback.onMediaButtonEvent has been added so you can override the default implementation and handle media buttons in a custom way. Could you please try this and see if it can solve your problem?
I'm re-tagging it as "bug" as we should figure out why the remote device doesn't resolve the double tap as next, because if it does, the remote device can define the behaviour of the tapping rather than the library or apps.
I think the issue is related to TV remotes that sends key events over Bluetooth. This may be a GoogleTV remote or a generic D-pad TV remote like for instance for a Sony Bravia.
The double-click detection seems to be most useful on mobile devices when a user has connected a BT headset to the device. I think it's justifiable to simply disable double-click detection on TV devices.
@charlesEnigma Any thoughts whether this would help for your case?
@marcbaechinger,
Yes, disabling double-click detection on TV devices would help our use case. By disabling double-click detection on TV devices we would simply be preventing the users from rapidly pressing buttons correct? For example, the user presses the "play/pause" button waits at least 2 seconds, and presses the "play/pause" button again triggering the "play/pause" functionality.
By disabling double-click detection on TV devices we would simply be preventing the users from rapidly pressing buttons correct?
The library doesn't swallow events after this change. All events will be delivered but the events won't be translated to a skip next event but the events arrive at the player resulting in pausing then playing again which is what the user intended to do with pressing twice.
Disable double-click detection on TV devices is this something the developer is expected to implement or will this be included in future versions of media3?
Activity
charlesEnigma commentedon Jan 11, 2024
Closing ticket. This issue is resolved with 1.2.0
charlesEnigma commentedon Jan 11, 2024
Sorry, for the confusion. When updating to version 1.2.0 our workaround was re-enabled so it appeared to be fixed but after removing the workaround we are seeing the issue in version 1.2.0 as well.
tianyif commentedon Jan 12, 2024
Hi @charlesEnigma,
Starting from 1.2.0,
MediaSession.Callback.onMediaButtonEventhas been added so you can override the default implementation and handle media buttons in a custom way. Could you please try this and see if it can solve your problem?tianyif commentedon Jan 12, 2024
I'm re-tagging it as "bug" as we should figure out why the remote device doesn't resolve the double tap as next, because if it does, the remote device can define the behaviour of the tapping rather than the library or apps.
marcbaechinger commentedon Jan 16, 2024
I think the issue is related to TV remotes that sends key events over Bluetooth. This may be a GoogleTV remote or a generic D-pad TV remote like for instance for a Sony Bravia.
The double-click detection seems to be most useful on mobile devices when a user has connected a BT headset to the device. I think it's justifiable to simply disable double-click detection on TV devices.
@charlesEnigma Any thoughts whether this would help for your case?
charlesEnigma commentedon Jan 16, 2024
@tianyif,
I will try overriding MediaSession.Callback.onMediaButtonEvent and see if we can handle the media buttons in a custom way.
@marcbaechinger,
Yes, disabling double-click detection on TV devices would help our use case. By disabling double-click detection on TV devices we would simply be preventing the users from rapidly pressing buttons correct? For example, the user presses the "play/pause" button waits at least 2 seconds, and presses the "play/pause" button again triggering the "play/pause" functionality.
Disable double-click detection for TV apps
marcbaechinger commentedon Jan 17, 2024
The library doesn't swallow events after this change. All events will be delivered but the events won't be translated to a skip next event but the events arrive at the player resulting in pausing then playing again which is what the user intended to do with pressing twice.
marcbaechinger commentedon Jan 17, 2024
I'm closing this issue as it is fixed with the commit above. Please open a new issue if required.
charlesEnigma commentedon Jan 18, 2024
@tianyif and @marcbaechinger ,
I was able to override KEYCODE_MEDIA_PLAY_PAUSE using [MediaSession.Callback.onMediaButtonEvent].
Questions:
marcbaechinger commentedon Jan 19, 2024
The commit referenced above implements this and this will be part of the next release.
charlesEnigma commentedon Jan 22, 2024
@marcbaechinger,
Awesome and thank you. The team will be looking forward to the next release. :-)