|
45 | 45 | import static org.schabi.newpipe.util.ListHelper.getPopupResolutionIndex;
|
46 | 46 | import static org.schabi.newpipe.util.ListHelper.getResolutionIndex;
|
47 | 47 | import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
48 |
| -import static java.util.Objects.requireNonNull; |
49 | 48 | import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
50 | 49 |
|
51 | 50 | import android.content.BroadcastReceiver;
|
|
87 | 86 | import org.schabi.newpipe.error.ErrorInfo;
|
88 | 87 | import org.schabi.newpipe.error.ErrorUtil;
|
89 | 88 | import org.schabi.newpipe.error.UserAction;
|
90 |
| -import org.schabi.newpipe.extractor.stream.AudioStream; |
91 | 89 | import org.schabi.newpipe.extractor.Image;
|
| 90 | +import org.schabi.newpipe.extractor.stream.AudioStream; |
92 | 91 | import org.schabi.newpipe.extractor.stream.StreamInfo;
|
93 | 92 | import org.schabi.newpipe.extractor.stream.StreamType;
|
94 | 93 | import org.schabi.newpipe.extractor.stream.VideoStream;
|
|
119 | 118 | import org.schabi.newpipe.util.DependentPreferenceHelper;
|
120 | 119 | import org.schabi.newpipe.util.ListHelper;
|
121 | 120 | import org.schabi.newpipe.util.NavigationHelper;
|
122 |
| -import org.schabi.newpipe.util.image.PicassoHelper; |
123 | 121 | import org.schabi.newpipe.util.SerializedCache;
|
124 | 122 | import org.schabi.newpipe.util.StreamTypeUtil;
|
| 123 | +import org.schabi.newpipe.util.image.PicassoHelper; |
125 | 124 |
|
126 | 125 | import java.util.List;
|
127 | 126 | import java.util.Optional;
|
@@ -416,9 +415,12 @@ public void handleIntent(@NonNull final Intent intent) {
|
416 | 415 | == com.google.android.exoplayer2.Player.STATE_IDLE) {
|
417 | 416 | simpleExoPlayer.prepare();
|
418 | 417 | }
|
| 418 | + // Seeks to a specific index and position in the player if the queue index has changed. |
419 | 419 | if (playQueue.getIndex() != newQueue.getIndex()) {
|
420 |
| - simpleExoPlayer.seekTo(newQueue.getIndex(), |
421 |
| - requireNonNull(newQueue.getItem()).getRecoveryPosition()); |
| 420 | + final PlayQueueItem queueItem = newQueue.getItem(); |
| 421 | + if (queueItem != null) { |
| 422 | + simpleExoPlayer.seekTo(newQueue.getIndex(), queueItem.getRecoveryPosition()); |
| 423 | + } |
422 | 424 | }
|
423 | 425 | simpleExoPlayer.setPlayWhenReady(playWhenReady);
|
424 | 426 |
|
|
0 commit comments