Skip to content

Commit a719b89

Browse files
priomsrbTobiGr
authored andcommitted
Fix playback not working after player enters idle state
On some phones (e.g. Oppo and Oneplus) the video player enters the STATE_IDLE 10 minutes after being paused. This causes the play button to stop working. This happens because once a player has become idle, we need to call prepare() before playback can happen again. But after I added prepare(), it would just skip to the end of the video. So now I'm executing the same code that happens when ERROR_CODE_UNSPECIFIED is done. This causes playback to resume normally.
1 parent 0533326 commit a719b89

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,13 @@ public void play() {
17521752
}
17531753
}
17541754

1755+
if (isStopped()) {
1756+
// Some phones suspend a paused player after 10 minutes. This causes the player to
1757+
// enter STATE_IDLE, causing playback to fail. So we try to recover from that here.
1758+
setRecovery();
1759+
reloadPlayQueueManager();
1760+
}
1761+
17551762
simpleExoPlayer.play();
17561763
saveStreamProgressState();
17571764
}

0 commit comments

Comments
 (0)