-
Notifications
You must be signed in to change notification settings - Fork 6k
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
StyledPlayerView.setOnClickListener doesn't work when useController=false #9605
Comments
I found these 2 related issues that kinda the motivation to disable the touch: IMO there are cases where the client doesn't enable the controller but still allows the user to click the video, for example, to switch between portrait and landscape. I'm curious if there is a way to enable such behavior. I have an idea of using a custom Controller UI that doesn't show anything ... But want to know if there is another approach. Feel free to close this issue if the current decision is fixed. |
This doesn't seem ideal. It looks like there are some other broken cases as well. For example, registering a long click listener doesn't work, regardless of whether there's a controller or not. I'm going to try and remove overriding of |
Overriding onTouchEvent was causing multiple issues, and appears to be unnecessary. Removing the override fixes: 1. StyledPlayerView accessibility issue where "hide player controls" actually toggled play/pause. 2. Delivery of events to a registered OnClickListener when useController is false. 3. Delivery of events to a registered OnLongClickListener in all configurations. 4. Incorrectly treating a sequence of touch events that exit the bounds of the view before ACTION_UP as a click, both for delivery to OnClickListener and for toggling the controls. Note: After this change, control visibility will not be toggled if the application developer explicitly sets the view to be non-clickable. I think that's probably working as intended though. It seems correct that a non-clickable view would not respond to clicks. Issue: google/ExoPlayer#8627 Issue: google/ExoPlayer#9605 Issue: google/ExoPlayer#9861 PiperOrigin-RevId: 433016626
Overriding onTouchEvent was causing multiple issues, and appears to be unnecessary. Removing the override fixes: 1. StyledPlayerView accessibility issue where "hide player controls" actually toggled play/pause. 2. Delivery of events to a registered OnClickListener when useController is false. 3. Delivery of events to a registered OnLongClickListener in all configurations. 4. Incorrectly treating a sequence of touch events that exit the bounds of the view before ACTION_UP as a click, both for delivery to OnClickListener and for toggling the controls. Note: After this change, control visibility will not be toggled if the application developer explicitly sets the view to be non-clickable. I think that's probably working as intended though. It seems correct that a non-clickable view would not respond to clicks. Issue: #8627 Issue: #9605 Issue: #9861 PiperOrigin-RevId: 433016626
Fixed in |
As the title suggests, if I set
useController
to false (either from XML, or code), the click listener just doesn't work.In
onTouchEvent
, StyledPlayerView returns false in such a case, so I think it was implemented that way, so I guess the current design isit should not accept a custom OnClickListener if the controller is disabled
. Is there any reason why? What should I do to have custom click listener without using the controller?ExoPlayer version: 2.15.1.
Tested device: LG G7/Android 10.
The text was updated successfully, but these errors were encountered: