File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/player/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,6 +235,11 @@ public void removeViewFromParent() {
235235 public void destroy () {
236236 super .destroy ();
237237
238+ if (DEBUG ) {
239+ Log .d (TAG , "Destroyed called trhrough notification kill" );
240+ }
241+
242+
238243 // Exit from fullscreen when user closes the player via notification
239244 if (isFullscreen ) {
240245 toggleFullscreen ();
@@ -943,6 +948,15 @@ public void toggleFullscreen() {
943948 binding .metadataView .setVisibility (isFullscreen ? View .VISIBLE : View .GONE );
944949 binding .playerCloseButton .setVisibility (isFullscreen ? View .GONE : View .VISIBLE );
945950 setupScreenRotationButton ();
951+
952+ // When the video ends, the player exits fullscreen mode but remains in landscape mode.
953+ // This corrects the orientation. See #13057.
954+ if (player .getCurrentState () == STATE_COMPLETED ) {
955+ player .getFragmentListener ()
956+ .ifPresent (PlayerServiceEventListener ::onScreenRotationButtonClicked );
957+ }
958+
959+
946960 }
947961
948962 public void checkLandscape () {
You can’t perform that action at this time.
0 commit comments