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:
@@ -117,6 +117,23 @@ class TrackActionsSheet extends ConsumerWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
_MenuItem(
|
||||
key: const Key('track_actions_start_radio'),
|
||||
icon: Icons.radio,
|
||||
label: 'Start radio',
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
try {
|
||||
await ref.read(playerActionsProvider).startRadio(track.id);
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("Couldn't start radio: $e")),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
const _Divider(),
|
||||
_MenuItem(
|
||||
key: const Key('track_actions_go_to_album'),
|
||||
|
||||
Reference in New Issue
Block a user