mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Keep controller visible on d-pad key events
PiperOrigin-RevId: 250661977
This commit is contained in:
parent
b8ec05aea1
commit
6e7012413b
2 changed files with 16 additions and 5 deletions
|
|
@ -24,6 +24,8 @@
|
||||||
`PlayerControlView`.
|
`PlayerControlView`.
|
||||||
* Change playback controls toggle from touch down to touch up events
|
* Change playback controls toggle from touch down to touch up events
|
||||||
([#5784](https://github.com/google/ExoPlayer/issues/5784)).
|
([#5784](https://github.com/google/ExoPlayer/issues/5784)).
|
||||||
|
* Fix issue where playback controls were not kept visible on key presses
|
||||||
|
([#5963](https://github.com/google/ExoPlayer/issues/5963)).
|
||||||
* Add a workaround for broken raw audio decoding on Oppo R9
|
* Add a workaround for broken raw audio decoding on Oppo R9
|
||||||
([#5782](https://github.com/google/ExoPlayer/issues/5782)).
|
([#5782](https://github.com/google/ExoPlayer/issues/5782)).
|
||||||
* Offline:
|
* Offline:
|
||||||
|
|
|
||||||
|
|
@ -772,11 +772,20 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
|
||||||
if (player != null && player.isPlayingAd()) {
|
if (player != null && player.isPlayingAd()) {
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
boolean isDpadWhenControlHidden =
|
|
||||||
isDpadKey(event.getKeyCode()) && useController && !controller.isVisible();
|
boolean isDpadAndUseController = isDpadKey(event.getKeyCode()) && useController;
|
||||||
boolean handled =
|
boolean handled = false;
|
||||||
isDpadWhenControlHidden || dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event);
|
if (isDpadAndUseController && !controller.isVisible()) {
|
||||||
if (handled) {
|
// Handle the key event by showing the controller.
|
||||||
|
maybeShowController(true);
|
||||||
|
handled = true;
|
||||||
|
} else if (dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event)) {
|
||||||
|
// The key event was handled as a media key or by the super class. We should also show the
|
||||||
|
// controller, or extend its show timeout if already visible.
|
||||||
|
maybeShowController(true);
|
||||||
|
handled = true;
|
||||||
|
} else if (isDpadAndUseController) {
|
||||||
|
// The key event wasn't handled, but we should extend the controller's show timeout.
|
||||||
maybeShowController(true);
|
maybeShowController(true);
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue