From 22f2351ea0e4f0f2df892c1d1df023b00879d0f6 Mon Sep 17 00:00:00 2001 From: Haggai Eran Date: Sat, 4 Feb 2023 18:05:28 +0200 Subject: [PATCH] player: seek to new index when given a new playqueue with a different index This happens in the MediaBrowserServiceCompat flow (playing a playlist). --- app/src/main/java/org/schabi/newpipe/player/Player.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index dcf97785a..7f5710b7e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -415,6 +415,10 @@ public final class Player implements PlaybackListener, Listener { == com.google.android.exoplayer2.Player.STATE_IDLE) { simpleExoPlayer.prepare(); } + if (playQueue.getIndex() != newQueue.getIndex()) { + simpleExoPlayer.seekTo(newQueue.getIndex(), + newQueue.getItem().getRecoveryPosition()); + } simpleExoPlayer.setPlayWhenReady(playWhenReady); } else if (intent.getBooleanExtra(RESUME_PLAYBACK, false)