P0/W2/TB: rewrite Home to wireframe spec, add site footer, expose CurrentTrack; fix dead base writes, genre href scroll-to-top
This commit is contained in:
@@ -24,6 +24,15 @@ public abstract class AudioPlayerService : IPlayerService, IAsyncDisposable
|
||||
public double Volume { get; protected set; } = 0.8;
|
||||
public double LoadProgress { get; protected set; } = 0;
|
||||
public string? ErrorMessage { get; protected set; }
|
||||
/// <summary>
|
||||
/// The currently selected track. In the streaming subclass this property is managed
|
||||
/// exclusively by <see cref="StreamingAudioPlayerService"/>: set in
|
||||
/// <c>LoadTrackStreaming</c> after <c>ResetToIdle</c> clears it, and cleared again
|
||||
/// by <c>ResetToIdle</c> on stop/unload/dispose. Base-class subclasses that take the
|
||||
/// <see cref="SelectTrack"/>/<see cref="Unload"/> path are responsible for managing
|
||||
/// it themselves.
|
||||
/// </summary>
|
||||
public TrackEntity? CurrentTrack { get; protected set; }
|
||||
|
||||
// Events
|
||||
public EventCallback? OnStateChanged { get; set; }
|
||||
@@ -68,12 +77,12 @@ public abstract class AudioPlayerService : IPlayerService, IAsyncDisposable
|
||||
public virtual async Task SelectTrack(TrackEntity track)
|
||||
{
|
||||
await EnsureInitializedAsync();
|
||||
|
||||
|
||||
await NotifyStateChanged();
|
||||
|
||||
|
||||
if (OnTrackSelected.HasValue)
|
||||
await OnTrackSelected.Value.InvokeAsync();
|
||||
|
||||
|
||||
await LoadTrack(track);
|
||||
await NotifyStateChanged();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ public interface IPlayerService
|
||||
double Volume { get; }
|
||||
double LoadProgress { get; }
|
||||
string? ErrorMessage { get; }
|
||||
|
||||
TrackEntity? CurrentTrack { get; }
|
||||
|
||||
// Events for UI updates
|
||||
EventCallback? OnStateChanged { get; set; }
|
||||
EventCallback? OnTrackSelected { get; set; }
|
||||
|
||||
@@ -70,6 +70,9 @@ public class StreamingAudioPlayerService : AudioPlayerService, IStreamingPlayerS
|
||||
|
||||
// Save track ID for seek operations
|
||||
_currentTrackId = track.EntryKey;
|
||||
// Expose to UI immediately — Now-Playing surfaces should reflect the selected
|
||||
// track while it's still loading, not only after playback starts.
|
||||
CurrentTrack = track;
|
||||
|
||||
// Create new cancellation token for this streaming operation
|
||||
_streamingCancellation = new CancellationTokenSource();
|
||||
@@ -434,6 +437,7 @@ public class StreamingAudioPlayerService : AudioPlayerService, IStreamingPlayerS
|
||||
Duration = null;
|
||||
LoadProgress = 0;
|
||||
ErrorMessage = null;
|
||||
CurrentTrack = null;
|
||||
|
||||
// 4. Reset streaming-specific state
|
||||
IsStreamingMode = false;
|
||||
|
||||
Reference in New Issue
Block a user