/** * Shows the playback controls. Does nothing if playback controls are disabled. * * <p>The playback controls are automatically hidden during playback after {{@link * #getControllerShowTimeoutMs()}}. They are shown indefinitely when playback has not started yet, * is paused, has ended or failed. */ public void showController() { showController(shouldShowControllerIndefinitely()); }
/** * Sets the playback controls timeout. The playback controls are automatically hidden after this * duration of time has elapsed without user input and with playback or buffering in progress. * * @param controllerShowTimeoutMs The timeout in milliseconds. A non-positive value will cause the * controller to remain visible indefinitely. */ public void setControllerShowTimeoutMs(int controllerShowTimeoutMs) { Assertions.checkState(controller != null); this.controllerShowTimeoutMs = controllerShowTimeoutMs; if (controller.isVisible()) { // Update the controller's timeout if necessary. showController(); } }
/** Shows the playback controls, but only if forced or shown indefinitely. */ private void maybeShowController(boolean isForced) { if (isPlayingAd() && controllerHideDuringAds) { return; } if (useController) { boolean wasShowingIndefinitely = controller.isVisible() && controller.getShowTimeoutMs() <= 0; boolean shouldShowIndefinitely = shouldShowControllerIndefinitely(); if (isForced || wasShowingIndefinitely || shouldShowIndefinitely) { showController(shouldShowIndefinitely); } } }