fix(queue): route scaffold masthead PLAY through queue; cache QueueItems snapshot
This commit is contained in:
@@ -13,6 +13,7 @@ namespace DeepDrftPublic.Client.Controls;
|
||||
public partial class ReleaseDetailScaffold : ComponentBase
|
||||
{
|
||||
[CascadingParameter] public IStreamingPlayerService? PlayerService { get; set; }
|
||||
[CascadingParameter] public IQueueService? Queue { get; set; }
|
||||
|
||||
[Parameter] public required string Title { get; set; }
|
||||
[Parameter] public string? Artist { get; set; }
|
||||
@@ -96,13 +97,19 @@ public partial class ReleaseDetailScaffold : ComponentBase
|
||||
{
|
||||
if (Track is null || PlayerService is null) return;
|
||||
|
||||
// Toggle if this track is already active (playing or paused); otherwise start a fresh
|
||||
// stream. SelectTrackStreaming is the live entry point — the buffered path is dead.
|
||||
// Toggle if this track is already active (playing or paused); otherwise PLAY it —
|
||||
// prepend to the queue's front (deque PLAY semantics) so it becomes current and
|
||||
// the existing queue stays intact behind it. Falls back to a direct stream when
|
||||
// the queue cascade is absent (prerender / non-interactive).
|
||||
var isThisTrack = PlayerService.CurrentTrack?.Id == Track.Id;
|
||||
if (isThisTrack && (PlayerService.IsPlaying || PlayerService.IsPaused))
|
||||
{
|
||||
await PlayerService.TogglePlayPause();
|
||||
}
|
||||
else if (Queue is not null)
|
||||
{
|
||||
await Queue.PlayTrack(Track);
|
||||
}
|
||||
else
|
||||
{
|
||||
await PlayerService.SelectTrackStreaming(Track);
|
||||
|
||||
Reference in New Issue
Block a user