Queue
Control playback order, manipulate the queue, and react to track changes in Nuclear.
Queue API for Plugins
The Queue API gives plugins control over Nuclear's playback queue. Add tracks, reorder items, control navigation, and subscribe to queue changes.
Core concepts
Queue structure
The queue is a list of items with a pointer to the current playback position:
type Queue = {
items: QueueItem[]; // Ordered list of tracks
currentIndex: number; // Position of currently playing item (0-based)
};Queue items
Each item in the queue has its own unique ID and tracks its own state:
type QueueItem = {
id: string; // UUID for this queue entry
track: Track; // Full track metadata
// Playback state
status: 'idle' | 'loading' | 'success' | 'error';
error?: string; // Error message if status is 'error'
// Metadata
addedAtIso: string; // ISO timestamp of when added
};Status lifecycle:
idle- Item is in queue but hasn't been played yetloading- Finding candidates, or stream resolution in progresssuccess- Stream resolved and ready for playbackerror- All streams failed or playback error occurred
Usage
Reference
Best practices
Use subscriptions for reactive features.
subscribe()for queue-wide changes,subscribeToCurrentItem()for playback tracking
Last updated