Commit 21b2a471 by tonihei Committed by Oliver Woodman

Toggle playback controls according to standard Android click handling.

We currently toggle the view in onTouchEvent ACTION_DOWN which is non-standard
and causes problems when used in a ViewGroup intercepting touch events.

Switch to standard Android click handling instead which is also what most
other player apps are doing.

Issue:#5784
PiperOrigin-RevId: 245219728
parent 84e03aea
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
even if they are listed lower in the `MediaCodecList`. even if they are listed lower in the `MediaCodecList`.
* Audio: fix an issue where not all audio was played out when the configuration * Audio: fix an issue where not all audio was played out when the configuration
for the underlying track was changing (e.g., at some period transitions). for the underlying track was changing (e.g., at some period transitions).
* UI: Change playback controls toggle from touch down to touch up events
([#5784](https://github.com/google/ExoPlayer/issues/5784)).
### 2.10.0 ### ### 2.10.0 ###
......
...@@ -303,6 +303,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -303,6 +303,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
private boolean controllerHideDuringAds; private boolean controllerHideDuringAds;
private boolean controllerHideOnTouch; private boolean controllerHideOnTouch;
private int textureViewRotation; private int textureViewRotation;
private boolean isTouching;
public PlayerView(Context context) { public PlayerView(Context context) {
this(context, null); this(context, null);
...@@ -1039,11 +1040,21 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -1039,11 +1040,21 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
} }
@Override @Override
public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent event) {
if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) { switch (event.getAction()) {
return false; case MotionEvent.ACTION_DOWN:
isTouching = true;
return true;
case MotionEvent.ACTION_UP:
if (isTouching) {
isTouching = false;
performClick();
return true;
}
return false;
default:
return false;
} }
return performClick();
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment