@@ -241,7 +241,7 @@ public void onServiceConnected(final Player connectedPlayer,
241
241
&& isAutoplayEnabled ()
242
242
&& player .getParentActivity () == null )) {
243
243
autoPlayEnabled = true ; // forcefully start playing
244
- openVideoPlayer ( true );
244
+ openVideoPlayerAutoFullscreen ( );
245
245
}
246
246
}
247
247
@@ -499,7 +499,7 @@ public void onClick(final View v) {
499
499
break ;
500
500
case R .id .detail_thumbnail_root_layout :
501
501
autoPlayEnabled = true ; // forcefully start playing
502
- openVideoPlayer ( true );
502
+ openVideoPlayerAutoFullscreen ( );
503
503
break ;
504
504
case R .id .detail_title_root_layout :
505
505
toggleTitleAndSecondaryControls ();
@@ -899,7 +899,7 @@ private void runWorker(final boolean forceLoad, final boolean addToBackStack) {
899
899
}
900
900
901
901
if (isAutoplayEnabled ()) {
902
- openVideoPlayer ( true );
902
+ openVideoPlayerAutoFullscreen ( );
903
903
}
904
904
}
905
905
}, throwable -> showError (new ErrorInfo (throwable , UserAction .REQUESTED_STREAM ,
@@ -1105,8 +1105,9 @@ private void openPopupPlayer(final boolean append) {
1105
1105
}
1106
1106
1107
1107
public void openVideoPlayer (final boolean directlyFullscreenIfApplicable ) {
1108
+ // Toggle to landscape orientation (which will then cause fullscreen mode) if we are not
1109
+ // already in landscape and screen orientation is locked.
1108
1110
if (directlyFullscreenIfApplicable
1109
- && PlayerHelper .isStartMainPlayerFullscreen (requireContext ())
1110
1111
&& !DeviceUtils .isLandscape (requireContext ())
1111
1112
&& PlayerHelper .globalScreenOrientationLocked (requireContext ())) {
1112
1113
// Make sure the bottom sheet turns out expanded. When this code kicks in the bottom
@@ -1129,6 +1130,12 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
1129
1130
}
1130
1131
}
1131
1132
1133
+ public void openVideoPlayerAutoFullscreen () {
1134
+ // if the option to start directly fullscreen is enabled, openVideoPlayer will be called
1135
+ // with directlyFullscreenIfApplicable=true and therefore open fullscreen if applicable
1136
+ openVideoPlayer (PlayerHelper .isStartMainPlayerFullscreen (requireContext ()));
1137
+ }
1138
+
1132
1139
private void openNormalBackgroundPlayer (final boolean append ) {
1133
1140
// See UI changes while remote playQueue changes
1134
1141
if (!isPlayerAvailable ()) {
0 commit comments