From 70dad9b1d3f0e6632222a296dce39ec0790d916a Mon Sep 17 00:00:00 2001 From: Y2kz <4github@y2kz.in> Date: Sun, 19 Apr 2026 12:36:48 +0530 Subject: [PATCH 1/4] Fix video playback when exiting popup to fullscreen Fix for the issue ( #6400 ) wrong video plays when exiting popup mode to fullscreen. --- .../fragments/detail/VideoDetailFragment.java | 16 ++++++++++++++-- .../schabi/newpipe/util/NavigationHelper.java | 6 +++++- 2 files changed, 19 insertions(+), 3 deletions(-) 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 da76a4b15b2..4e790a06773 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 @@ -205,6 +205,7 @@ public final class VideoDetailFragment int lastStableBottomSheetState = BottomSheetBehavior.STATE_EXPANDED; @State protected boolean autoPlayEnabled = true; + private boolean forceFullscreen = false; @Nullable private StreamInfo currentInfo = null; @@ -877,7 +878,7 @@ private void runWorker(final boolean forceLoad, final boolean addToBackStack) { } } - if (isAutoplayEnabled()) { + if (isAutoplayEnabled() || forceFullscreen) { openVideoPlayerAutoFullscreen(); } } @@ -1142,7 +1143,18 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) { * = false}, hence preventing it from going directly fullscreen. */ public void openVideoPlayerAutoFullscreen() { - openVideoPlayer(PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())); + openVideoPlayer(forceFullscreen || PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())); + forceFullscreen = false; + } + + public void setForceFullscreen(final boolean force) { + this.forceFullscreen = force; + } + + //return the URL of the stream currently handled by this fragment. + @Nullable + public String getUrl() { + return url; } private void openNormalBackgroundPlayer(final boolean append) { 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 bfdf6a02cdf..9632b9bee30 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -1,6 +1,7 @@ package org.schabi.newpipe.util; import static android.text.TextUtils.isEmpty; +import android.text.TextUtils; import static org.schabi.newpipe.util.ListHelper.getUrlAndNonTorrentStreams; import android.annotation.SuppressLint; @@ -430,13 +431,16 @@ public static void openVideoDetailFragment(@NonNull final Context context, final RunnableWithVideoDetailFragment onVideoDetailFragmentReady = detailFragment -> { expandMainPlayer(detailFragment.requireActivity()); detailFragment.setAutoPlay(autoPlay); - if (switchingPlayers) { + if (switchingPlayers && TextUtils.equals(detailFragment.getUrl(), url)) { // Situation when user switches from players to main player. All needed data is // here, we can start watching (assuming newQueue equals playQueue). // Starting directly in fullscreen if the previous player type was popup. detailFragment.openVideoPlayer(playerType == PlayerType.POPUP || PlayerHelper.isStartMainPlayerFullscreenEnabled(context)); } else { + if (switchingPlayers && playerType == PlayerType.POPUP) { + detailFragment.setForceFullscreen(true); + } detailFragment.selectAndLoadVideo(serviceId, url, title, playQueue); } detailFragment.scrollToTop(); From 5cc2950ec8b5926f4835ae4cdb5654489509f7d1 Mon Sep 17 00:00:00 2001 From: Y2kz <4github@y2kz.in> Date: Sun, 19 Apr 2026 15:56:55 +0530 Subject: [PATCH 2/4] Split line into two address CI build error Split line into two address CI build error -VideoDetailFragment.java:1146: Line is longer than 100 characters (found 110). [LineLength] --- .../schabi/newpipe/fragments/detail/VideoDetailFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 4e790a06773..a28015b9796 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 @@ -1143,7 +1143,8 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) { * = false}, hence preventing it from going directly fullscreen. */ public void openVideoPlayerAutoFullscreen() { - openVideoPlayer(forceFullscreen || PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())); + openVideoPlayer(forceFullscreen + || PlayerHelper.isStartMainPlayerFullscreenEnabled(requireContext())); forceFullscreen = false; } From f29b465af666695e797339a6e32242a8d8732cb6 Mon Sep 17 00:00:00 2001 From: Y2kz <4github@y2kz.in> Date: Mon, 20 Apr 2026 14:21:28 +0530 Subject: [PATCH 3/4] Removed comment Removed comment in commit --- .../org/schabi/newpipe/fragments/detail/VideoDetailFragment.java | 1 - 1 file changed, 1 deletion(-) 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 a28015b9796..29a94fd0f79 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 @@ -1152,7 +1152,6 @@ public void setForceFullscreen(final boolean force) { this.forceFullscreen = force; } - //return the URL of the stream currently handled by this fragment. @Nullable public String getUrl() { return url; From 1144f66aedfa041d94fbbcb0a1dc302045f7271f Mon Sep 17 00:00:00 2001 From: Y2kz <4github@y2kz.in> Date: Sat, 25 Apr 2026 12:54:38 +0530 Subject: [PATCH 4/4] Update Javadoc for openVideoPlayerAutoFullscreen --- .../fragments/detail/VideoDetailFragment.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 29a94fd0f79..ee93e313846 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 @@ -1135,12 +1135,15 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) { } /** - * If the option to start directly fullscreen is enabled, calls - * {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true}, so that - * if the user is not already in landscape and he has screen orientation locked the activity - * rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen is - * disabled, calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable - * = false}, hence preventing it from going directly fullscreen. + * If the option to start directly fullscreen is enabled, or if {@code forceFullscreen} is + * {@code true} (e.g. when switching from popup player to main player with a different video), + * calls {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = true}, + * so that if the user is not already in landscape and he has screen orientation locked the + * activity rotates and fullscreen starts. Otherwise, if the option to start directly fullscreen + * is disabled and {@code forceFullscreen} is {@code false}, calls + * {@link #openVideoPlayer(boolean)} with {@code directlyFullscreenIfApplicable = false}, + * hence preventing it from going directly fullscreen. + * {@code forceFullscreen} is reset to {@code false} after this call. */ public void openVideoPlayerAutoFullscreen() { openVideoPlayer(forceFullscreen