1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-08 16:30:34 +00:00

player: seek to new index when given a new playqueue with a different index

This happens in the MediaBrowserServiceCompat flow (playing a playlist).
This commit is contained in:
Haggai Eran 2023-02-04 18:05:28 +02:00 committed by Siddhesh Naik
parent 4e64b875dc
commit 22f2351ea0

View File

@ -415,6 +415,10 @@ public final class Player implements PlaybackListener, Listener {
== com.google.android.exoplayer2.Player.STATE_IDLE) { == com.google.android.exoplayer2.Player.STATE_IDLE) {
simpleExoPlayer.prepare(); simpleExoPlayer.prepare();
} }
if (playQueue.getIndex() != newQueue.getIndex()) {
simpleExoPlayer.seekTo(newQueue.getIndex(),
newQueue.getItem().getRecoveryPosition());
}
simpleExoPlayer.setPlayWhenReady(playWhenReady); simpleExoPlayer.setPlayWhenReady(playWhenReady);
} else if (intent.getBooleanExtra(RESUME_PLAYBACK, false) } else if (intent.getBooleanExtra(RESUME_PLAYBACK, false)