1
0
Fork 0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2025-10-03 09:49:21 +02:00

Player/handleIntent: fix enqueue if player not running

In 063dcd41e5 I falsely claimed that the
fallthrough case is always degenerate, but it kinda somehow still
worked because if you long-click on e.g. the popup button, it would
call enqueue, but if nothing was running yet it would fallthrough to
the very last case and start the player with the video.

So let’s return to that and add a TODO for further refactoring in the
future.
This commit is contained in:
Profpatsch 2025-09-05 19:02:04 +02:00
parent 01f9a3de33
commit d77771a60c

View file

@ -394,9 +394,13 @@ public final class Player implements PlaybackListener, Listener {
return; return;
} }
playQueue.append(newQueue.getStreams()); playQueue.append(newQueue.getStreams());
}
return; return;
} }
// TODO: This falls through to the old logic, there was no playQueue
// yet so we should start the player and add the new video
break;
}
case EnqueueNext -> { case EnqueueNext -> {
if (playQueue != null) { if (playQueue != null) {
final PlayQueue newQueue = getPlayQueueFromCache(intent); final PlayQueue newQueue = getPlayQueueFromCache(intent);
@ -405,9 +409,13 @@ public final class Player implements PlaybackListener, Listener {
} }
final PlayQueueItem newItem = newQueue.getStreams().get(0); final PlayQueueItem newItem = newQueue.getStreams().get(0);
newQueue.enqueueNext(newItem, false); newQueue.enqueueNext(newItem, false);
}
return; return;
} }
// TODO: This falls through to the old logic, there was no playQueue
// yet so we should start the player and add the new video
break;
}
case TimestampChange -> { case TimestampChange -> {
final TimestampChangeData dat = intent.getParcelableExtra(PLAYER_INTENT_DATA); final TimestampChangeData dat = intent.getParcelableExtra(PLAYER_INTENT_DATA);
assert dat != null; assert dat != null;