fix: refactor fullScreenPlayerView creation

This commit is contained in:
olivier bouillet 2022-11-03 23:05:39 +01:00
parent 845f34fefd
commit a323bd0523

View File

@ -372,6 +372,15 @@ class ReactExoplayerView extends FrameLayout implements
playerControlView = new PlayerControlView(getContext()); playerControlView = new PlayerControlView(getContext());
} }
if (fullScreenPlayerView == null) {
fullScreenPlayerView = new FullScreenPlayerView(getContext(), exoPlayerView, playerControlView, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
setFullscreen(false);
}
});
}
// Setting the player for the playerControlView // Setting the player for the playerControlView
playerControlView.setPlayer(player); playerControlView.setPlayer(player);
playPauseControlContainer = playerControlView.findViewById(R.id.exo_play_pause_container); playPauseControlContainer = playerControlView.findViewById(R.id.exo_play_pause_container);
@ -679,12 +688,6 @@ class ReactExoplayerView extends FrameLayout implements
setControls(controls); setControls(controls);
applyModifiers(); applyModifiers();
startBufferCheckTimer(); startBufferCheckTimer();
fullScreenPlayerView = new FullScreenPlayerView(getContext(), exoPlayerView, playerControlView, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
setFullscreen(false);
}
});
} }
private DrmSessionManager buildDrmSessionManager(UUID uuid, String licenseUrl, String[] keyRequestPropertiesArray) throws UnsupportedDrmException { private DrmSessionManager buildDrmSessionManager(UUID uuid, String licenseUrl, String[] keyRequestPropertiesArray) throws UnsupportedDrmException {
@ -1786,15 +1789,6 @@ class ReactExoplayerView extends FrameLayout implements
return; return;
} }
if (fullScreenPlayerView == null) {
fullScreenPlayerView = new FullScreenPlayerView(getContext(), exoPlayerView, playerControlView, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
setFullscreen(false);
}
});
}
Window window = activity.getWindow(); Window window = activity.getWindow();
View decorView = window.getDecorView(); View decorView = window.getDecorView();
int uiOptions; int uiOptions;