Skip to content

Commit bd9dcfb

Browse files
authored
Merge pull request #7381 from litetex/prevent-automatic-replay-after-returning-from-background
Prevent automatic replay after returning from background
2 parents d5199ea + 316db0e commit bd9dcfb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,10 +857,10 @@ public void setRecovery() {
857857

858858
final int queuePos = playQueue.getIndex();
859859
final long windowPos = simpleExoPlayer.getCurrentPosition();
860+
final long duration = simpleExoPlayer.getDuration();
860861

861-
if (windowPos > 0 && windowPos <= simpleExoPlayer.getDuration()) {
862-
setRecovery(queuePos, windowPos);
863-
}
862+
// No checks due to https://github.com/TeamNewPipe/NewPipe/pull/7195#issuecomment-962624380
863+
setRecovery(queuePos, Math.max(0, Math.min(windowPos, duration)));
864864
}
865865

866866
private void setRecovery(final int queuePos, final long windowPos) {

0 commit comments

Comments
 (0)