File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -857,9 +857,15 @@ 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 );
862+ if (windowPos > 0
863+ // Sometimes (e.g. when the playback ended) the windowPos is a few milliseconds
864+ // higher than the duration. Due to this a little buffer (100ms) was introduced.
865+ // See also https://github.com/TeamNewPipe/NewPipe/pull/7195#issuecomment-962624380
866+ && windowPos <= duration + 100
867+ ) {
868+ setRecovery (queuePos , Math .min (windowPos , duration ));
863869 }
864870 }
865871
You can’t perform that action at this time.
0 commit comments