Skip to content

Commit 3217e2a

Browse files
author
Anpa
committed
When the video state is completed, the orientation is changed back with onScreenRotationButtonClicked.
1 parent 15b5cef commit 3217e2a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/ui/MainPlayerUi.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)