mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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
This commit is contained in:
parent
84e03aea70
commit
21b2a471bb
2 changed files with 17 additions and 4 deletions
|
|
@ -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
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue