-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(android): controls always show in fullscreen #4813
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
base: support/6.x.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -446,8 +446,8 @@ private void initializePlayerControl() { | |
| private void updateControllerConfig() { | ||
| if (exoPlayerView == null) return; | ||
|
|
||
| // Extra configuration for proper touch handling | ||
| exoPlayerView.setControllerShowTimeoutMs(5000); | ||
|
|
||
| exoPlayerView.setControllerAutoShow(true); | ||
| exoPlayerView.setControllerHideOnTouch(true); | ||
|
|
||
|
|
@@ -456,8 +456,9 @@ private void updateControllerConfig() { | |
|
|
||
| private void updateControllerVisibility() { | ||
| if (exoPlayerView == null) return; | ||
|
|
||
| exoPlayerView.setUseController(controls && !controlsConfig.getHideFullscreen()); | ||
|
|
||
| boolean shouldShowControls = controls || isFullscreen; | ||
| exoPlayerView.setUseController(shouldShowControls); | ||
| } | ||
|
|
||
| private void openSettings() { | ||
|
|
@@ -498,10 +499,6 @@ private void showPlaybackSpeedOptions() { | |
| builder.show(); | ||
| } | ||
|
|
||
| private void addPlayerControl() { | ||
| updateControllerConfig(); | ||
| } | ||
|
|
||
| /** | ||
| * Update the layout | ||
| * @param view view needs to update layout | ||
|
|
@@ -516,7 +513,8 @@ private void reLayout(View view) { | |
| } | ||
|
|
||
| private void refreshControlsStyles() { | ||
| if (exoPlayerView == null || player == null || !controls) return; | ||
| if (exoPlayerView == null || player == null) return; | ||
| // Always update controller visibility to ensure it matches current state | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you delete this comment? |
||
| updateControllerVisibility(); | ||
| } | ||
|
|
||
|
|
@@ -2642,6 +2640,10 @@ public void handleOnBackPressed() { | |
| setFullscreen(false); | ||
| } | ||
| }, controlsConfig); | ||
| updateControllerConfig(); | ||
| if (exoPlayerView != null) { | ||
| exoPlayerView.showController(); | ||
| } | ||
|
Comment on lines
+2644
to
+2646
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary? |
||
| eventEmitter.onVideoFullscreenPlayerWillPresent.invoke(); | ||
| if (fullScreenPlayerView != null) { | ||
| fullScreenPlayerView.show(); | ||
|
|
@@ -2654,7 +2656,10 @@ public void handleOnBackPressed() { | |
| if (fullScreenPlayerView != null) { | ||
| fullScreenPlayerView.dismiss(); | ||
| reLayoutControls(); | ||
| setControls(controls); | ||
| refreshControlsStyles(); | ||
| if (!controls && exoPlayerView != null) { | ||
| exoPlayerView.hideController(); | ||
| } | ||
| } | ||
| UiThreadUtil.runOnUiThread(() -> { | ||
| eventEmitter.onVideoFullscreenPlayerDidDismiss.invoke(); | ||
|
|
@@ -2697,20 +2702,13 @@ public void onDrmKeysRemoved(int windowIndex, MediaSource.MediaPeriodId mediaPer | |
| * Handling controls prop | ||
| * | ||
| * @param controls Controls prop, if true enable controls, if false disable them | ||
| * Note: Controls are always visible in fullscreen mode, even if controls={false} | ||
| */ | ||
| public void setControls(boolean controls) { | ||
| this.controls = controls; | ||
| if (exoPlayerView != null) { | ||
| exoPlayerView.setUseController(controls); | ||
| // Additional configuration for proper touch handling | ||
| if (controls) { | ||
| exoPlayerView.setControllerAutoShow(true); | ||
| exoPlayerView.setControllerHideOnTouch(true); // Show controls on touch, don't hide | ||
| exoPlayerView.setControllerShowTimeoutMs(5000); | ||
| } | ||
| } | ||
| if (controls) { | ||
| addPlayerControl(); | ||
| boolean shouldShowControls = controls || isFullscreen; | ||
| if (shouldShowControls) { | ||
| updateControllerConfig(); | ||
|
Comment on lines
+2709
to
+2711
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the configuration we deleted? |
||
| } | ||
| refreshControlsStyles(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you delete this comment?