@@ -205,6 +205,7 @@ public final class VideoDetailFragment
205205 int lastStableBottomSheetState = BottomSheetBehavior .STATE_EXPANDED ;
206206 @ State
207207 protected boolean autoPlayEnabled = true ;
208+ private boolean forceFullscreen = false ;
208209
209210 @ Nullable
210211 private StreamInfo currentInfo = null ;
@@ -877,7 +878,7 @@ private void runWorker(final boolean forceLoad, final boolean addToBackStack) {
877878 }
878879 }
879880
880- if (isAutoplayEnabled ()) {
881+ if (isAutoplayEnabled () || forceFullscreen ) {
881882 openVideoPlayerAutoFullscreen ();
882883 }
883884 }
@@ -1134,15 +1135,29 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
11341135 }
11351136
11361137 /**
1137- * If the option to start directly fullscreen is enabled, calls
1138- * {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true}, so that
1139- * if the user is not already in landscape and he has screen orientation locked the activity
1140- * rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen is
1141- * disabled, calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable
1142- * = false}, hence preventing it from going directly fullscreen.
1138+ * If the option to start directly fullscreen is enabled, or if {@code forceFullscreen} is
1139+ * {@code true} (e.g. when switching from popup player to main player with a different video),
1140+ * calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true},
1141+ * so that if the user is not already in landscape and he has screen orientation locked the
1142+ * activity rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen
1143+ * is disabled and {@code forceFullscreen} is {@code false}, calls
1144+ * {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = false},
1145+ * hence preventing it from going directly fullscreen.
1146+ * {@code forceFullscreen} is reset to {@code false} after this call.
11431147 */
11441148 public void openVideoPlayerAutoFullscreen () {
1145- openVideoPlayer (PlayerHelper .isStartMainPlayerFullscreenEnabled (requireContext ()));
1149+ openVideoPlayer (forceFullscreen
1150+ || PlayerHelper .isStartMainPlayerFullscreenEnabled (requireContext ()));
1151+ forceFullscreen = false ;
1152+ }
1153+
1154+ public void setForceFullscreen (final boolean force ) {
1155+ this .forceFullscreen = force ;
1156+ }
1157+
1158+ @ Nullable
1159+ public String getUrl () {
1160+ return url ;
11461161 }
11471162
11481163 private void openNormalBackgroundPlayer (final boolean append ) {
0 commit comments