feat: show actual stream quality in player UI

Issue #34 - Display actual stream quality, not track metadata

Backend changes:
- Add sample_rate and bit_depth to PlaybackEvent
- Add stream quality tracking to SharedState
- Extract bit_depth from FLAC/M4A headers in streaming path
- Player sets stream quality when decoding audio

Frontend changes:
- Update PlaybackEvent interface with new fields
- Update currentTrack with actual stream quality from backend

This allows the UI to show the actual quality being played (e.g., 44.1kHz
when streaming a 192kHz track at CD Quality) instead of the track's
maximum advertised quality.
This commit is contained in:
vicrodh committed 2026-01-31 23:32:29 -06:00
1 parent 38b7ea7aef
commit 8b7e4dab27
4 files changed
+110 -31

No files matched your search

+13
View File
@@ -68,6 +68,8 @@ interface PlaybackEvent {
duration: number;
track_id: number;
volume: number;
sample_rate: number | null; // Actual stream sample rate in Hz
bit_depth: number | null; // Actual stream bit depth
}
// ============ State ============
@@ -413,6 +415,17 @@ async function handlePlaybackEvent(event: PlaybackEvent): Promise<void> {
if (event.track_id === currentTrack.id) {
currentTime = event.position;
isPlaying = event.is_playing;
// Update track with actual stream quality (issue #34)
// The backend now sends the real sample rate and bit depth from the decoded stream
if (event.sample_rate && event.sample_rate > 0) {
// Convert Hz to kHz for display (44100 -> 44.1)
currentTrack.samplingRate = event.sample_rate / 1000;
}
if (event.bit_depth && event.bit_depth > 0) {
currentTrack.bitDepth = event.bit_depth;
}
notifyListeners();
// Check if track ended - auto-advance to next