Merge pull request #7381 from litetex/prevent-automatic-replay-after-returning-from-background

Prevent automatic replay after returning from background
This commit is contained in:
XiangRongLin 2021-11-17 09:38:09 +01:00 committed by GitHub
commit bd9dcfb28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -857,10 +857,10 @@ public final class Player implements
final int queuePos = playQueue.getIndex(); final int queuePos = playQueue.getIndex();
final long windowPos = simpleExoPlayer.getCurrentPosition(); final long windowPos = simpleExoPlayer.getCurrentPosition();
final long duration = simpleExoPlayer.getDuration();
if (windowPos > 0 && windowPos <= simpleExoPlayer.getDuration()) { // No checks due to https://github.com/TeamNewPipe/NewPipe/pull/7195#issuecomment-962624380
setRecovery(queuePos, windowPos); setRecovery(queuePos, Math.max(0, Math.min(windowPos, duration)));
}
} }
private void setRecovery(final int queuePos, final long windowPos) { private void setRecovery(final int queuePos, final long windowPos) {