From 3217e2adbdc3edf78a57032560fe650cd8a7ea5c Mon Sep 17 00:00:00 2001 From: Anpa Date: Mon, 2 Feb 2026 11:09:08 +0100 Subject: [PATCH 1/2] When the video state is completed, the orientation is changed back with onScreenRotationButtonClicked. --- .../org/schabi/newpipe/player/ui/MainPlayerUi.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java index 868881782..b5e56dd66 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java @@ -235,6 +235,11 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh public void destroy() { super.destroy(); + if (DEBUG) { + Log.d(TAG, "Destroyed called trhrough notification kill"); + } + + // Exit from fullscreen when user closes the player via notification if (isFullscreen) { toggleFullscreen(); @@ -943,6 +948,15 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh binding.metadataView.setVisibility(isFullscreen ? View.VISIBLE : View.GONE); binding.playerCloseButton.setVisibility(isFullscreen ? View.GONE : View.VISIBLE); setupScreenRotationButton(); + + // When the video ends, the player exits fullscreen mode but remains in landscape mode. + // This corrects the orientation. See #13057. + if (player.getCurrentState() == STATE_COMPLETED) { + player.getFragmentListener() + .ifPresent(PlayerServiceEventListener::onScreenRotationButtonClicked); + } + + } public void checkLandscape() { From fcec04f96d793ce1dd6406e79c46263bf3bcdbaa Mon Sep 17 00:00:00 2001 From: Anparasan Anpukkody Date: Mon, 2 Feb 2026 11:52:07 +0100 Subject: [PATCH 2/2] Removed debug Log lines. --- .../java/org/schabi/newpipe/player/ui/MainPlayerUi.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java index b5e56dd66..eb4f8796d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java @@ -234,12 +234,6 @@ public final class MainPlayerUi extends VideoPlayerUi implements View.OnLayoutCh @Override public void destroy() { super.destroy(); - - if (DEBUG) { - Log.d(TAG, "Destroyed called trhrough notification kill"); - } - - // Exit from fullscreen when user closes the player via notification if (isFullscreen) { toggleFullscreen();