feat(flutter/player): playNext + enqueue + PlaylistsApi.appendTracks

Three small data-layer additions for the upcoming track-actions menu:

- PlaylistsApi.appendTracks(playlistId, trackIds) wraps
  POST /api/playlists/{id}/tracks for the "Add to playlist" action.
- audio_handler gains playNext (insertAudioSource at currentIndex+1)
  and enqueue (addAudioSource) — both also push the audio_service
  queue notifier so the queue-screen UI stays in sync.
- The AudioSource construction was extracted into a private
  _buildAudioSource helper so setQueueFromTracks / playNext / enqueue
  share one source-building path.
- PlayerActions exposes playNext / enqueue for menu use.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 13:40:17 -04:00
parent 5159bcd3f4
commit 2499449c0b
3 changed files with 65 additions and 20 deletions
@@ -42,6 +42,16 @@ class PlayerActions {
await h.setQueueFromTracks(tracks, initialIndex: initialIndex);
await h.play();
}
Future<void> playNext(TrackRef track) async {
final h = _ref.read(audioHandlerProvider);
await h.playNext(track);
}
Future<void> enqueue(TrackRef track) async {
final h = _ref.read(audioHandlerProvider);
await h.enqueue(track);
}
}
final playerActionsProvider = Provider<PlayerActions>((ref) => PlayerActions(ref));