fix(flutter): player updates on track change + kebab artist nav + Start radio
Three issues, all related to the player surface: 1. Player UI didn't update on track change. audio_handler's _onCurrentIndexChanged only kicked off the cover load — it never pushed the new MediaItem onto the mediaItem stream. Title/artist/ cover stayed pinned to whatever setQueueFromTracks(initialIndex:) set on first play. Now the listener pushes queue[idx] when the index changes. 2. Player kebab "Go to artist" 404'd while the same item from MostPlayed worked. Same TrackActionsSheet for both, but the player's _trackRefFromMediaItem was hardcoding artistId: '' because audio_handler's _toMediaItem never stashed it in extras. Stash artist_id alongside album_id; player_bar + now_playing_screen read it back. Both kebabs now navigate. 3. "Start radio" didn't exist on Flutter even though the server has /api/radio?seed_track=<id>. New RadioApi (lib/api/endpoints/ radio.dart) wraps the endpoint; PlayerActions.startRadio(trackId) fetches + plays the result via the existing playTracks path. New menu item between "Add to playlist" and the divider above "Go to album", calls startRadio with a snackbar error fallback.
This commit is contained in:
@@ -286,7 +286,9 @@ TrackRef _trackRefFromMediaItem(MediaItem media) => TrackRef(
|
||||
title: media.title,
|
||||
albumId: (media.extras?['album_id'] as String?) ?? '',
|
||||
albumTitle: media.album ?? '',
|
||||
artistId: '',
|
||||
// artist_id is stashed in extras by audio_handler — without it
|
||||
// the kebab's "Go to artist" pushes /artists/ (empty id) and 404s.
|
||||
artistId: (media.extras?['artist_id'] as String?) ?? '',
|
||||
artistName: media.artist ?? '',
|
||||
durationSec: media.duration?.inSeconds ?? 0,
|
||||
streamUrl: '',
|
||||
|
||||
Reference in New Issue
Block a user