diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
index 0b3ddc3c3..a39ef0a0a 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
@@ -241,7 +241,7 @@ public final class VideoDetailFragment
&& isAutoplayEnabled()
&& player.getParentActivity() == null)) {
autoPlayEnabled = true; // forcefully start playing
- openVideoPlayer();
+ openVideoPlayer(true);
}
}
@@ -499,7 +499,7 @@ public final class VideoDetailFragment
break;
case R.id.detail_thumbnail_root_layout:
autoPlayEnabled = true; // forcefully start playing
- openVideoPlayer();
+ openVideoPlayer(true);
break;
case R.id.detail_title_root_layout:
toggleTitleAndSecondaryControls();
@@ -516,7 +516,7 @@ public final class VideoDetailFragment
showSystemUi();
} else {
autoPlayEnabled = true; // forcefully start playing
- openVideoPlayer();
+ openVideoPlayer(false);
}
setOverlayPlayPauseImage(isPlayerAvailable() && player.isPlaying());
@@ -897,8 +897,9 @@ public final class VideoDetailFragment
stack.push(new StackItem(serviceId, url, title, playQueue));
}
}
+
if (isAutoplayEnabled()) {
- openVideoPlayer();
+ openVideoPlayer(true);
}
}
}, throwable -> showError(new ErrorInfo(throwable, UserAction.REQUESTED_STREAM,
@@ -1103,7 +1104,15 @@ public final class VideoDetailFragment
}
}
- public void openVideoPlayer() {
+ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
+ if (directlyFullscreenIfApplicable
+ && PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())
+ && !isLandscape()
+ && PlayerHelper.globalScreenOrientationLocked(requireContext())) {
+ // open directly in fullscreen TODO does it work for large-land layouts?
+ onScreenRotationButtonClicked();
+ }
+
if (PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(this.getString(R.string.use_external_video_player_key), false)) {
showExternalPlaybackDialog();
@@ -1145,8 +1154,8 @@ public final class VideoDetailFragment
}
addVideoPlayerView();
- final Intent playerIntent = NavigationHelper
- .getPlayerIntent(requireContext(), MainPlayer.class, queue, true, autoPlayEnabled);
+ final Intent playerIntent = NavigationHelper.getPlayerIntent(requireContext(),
+ MainPlayer.class, queue, true, autoPlayEnabled);
ContextCompat.startForegroundService(activity, playerIntent);
}
@@ -2022,7 +2031,7 @@ public final class VideoDetailFragment
}
}
- private boolean isLandscape() {
+ public boolean isLandscape() {
return getResources().getDisplayMetrics().heightPixels < getResources()
.getDisplayMetrics().widthPixels;
}
diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java
index ae9720474..10532c5eb 100644
--- a/app/src/main/java/org/schabi/newpipe/player/Player.java
+++ b/app/src/main/java/org/schabi/newpipe/player/Player.java
@@ -3855,11 +3855,9 @@ public final class Player implements
if (DEBUG) {
Log.d(TAG, "toggleFullscreen() called");
}
- if (popupPlayerSelected() || exoPlayerIsNull() || currentMetadata == null
- || fragmentListener == null) {
+ if (popupPlayerSelected() || exoPlayerIsNull() || fragmentListener == null) {
return;
}
- //changeState(STATE_BLOCKED); TODO check what this does
isFullscreen = !isFullscreen;
if (!isFullscreen) {
diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
index b19e6e823..828833a8d 100644
--- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
@@ -239,6 +239,11 @@ public final class PlayerHelper {
.getBoolean(context.getString(R.string.brightness_gesture_control_key), true);
}
+ public static boolean isStartMainPlayerFullscreenEnabled(@NonNull final Context context) {
+ return getPreferences(context)
+ .getBoolean(context.getString(R.string.start_main_player_fullscreen_key), false);
+ }
+
public static boolean isAutoQueueEnabled(@NonNull final Context context) {
return getPreferences(context)
.getBoolean(context.getString(R.string.auto_queue_key), false);
diff --git a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
index ad9654073..539387082 100644
--- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java
@@ -366,7 +366,15 @@ public final class NavigationHelper {
if (switchingPlayers) {
// Situation when user switches from players to main player. All needed data is
// here, we can start watching (assuming newQueue equals playQueue).
- detailFragment.openVideoPlayer();
+
+ // Starting directly in fullscreen if the previous player type was popup.
+ if (playerType == MainPlayer.PlayerType.POPUP
+ && !detailFragment.isLandscape()
+ && PlayerHelper.globalScreenOrientationLocked(context)) {
+ detailFragment.onScreenRotationButtonClicked();
+ }
+ // pass false to directlyFullscreenIfApplicable since that's handled just above here
+ detailFragment.openVideoPlayer(false);
} else {
detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue);
}
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index 45400d667..013b970c1 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -73,6 +73,8 @@
- @string/minimize_on_exit_popup_description
+ start_main_player_fullscreen_key
+
autoplay_key
@string/autoplay_wifi_key
autoplay_always_key
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 91e9db335..f833dc716 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -132,6 +132,8 @@
Resume playing
Continue playing after interruptions (e.g. phonecalls)
Download
+ Start main player in fullscreen
+ Do not start videos in the mini player, but turn to fullscreen mode directly, if auto rotation is locked. You can still access the mini player by exiting fullscreen.
Autoplay
Show \"Hold to append\" tip
Show tip when pressing the background or the popup button in video \"Details:\"
diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml
index 1b595be0c..f605fbe17 100644
--- a/app/src/main/res/xml/video_audio_settings.xml
+++ b/app/src/main/res/xml/video_audio_settings.xml
@@ -129,6 +129,14 @@
app:singleLineTitle="false"
app:iconSpaceReserved="false" />
+
+