React Native Audio Pro provides a queue API that is directly aligned with Android’s Media3Documentation Index
Fetch the complete documentation index at: https://mintlify.com/afkcodes/react-native-audio-pro/llms.txt
Use this file to discover all available pages before exploring further.
ExoPlayer interface, making the mental model familiar to Android developers and ensuring predictable behavior on both platforms. The queue holds an ordered list of AudioProTrack objects. You can add, insert, remove, reorder, and replace tracks at any time — even during active playback. Queue mutations are applied immediately by the native player without interrupting the currently playing item.
Track Shape
Every item in the queue is anAudioProTrack object:
duration, genre, podcastId) can be stored on the track object and will be passed through in event payloads as-is. The native layer ignores unknown keys.
Queue Methods
addMediaItems(items)
Appends one or more tracks to the end of the queue. Accepts a single AudioProTrack or an array of them.
setMediaItems(items)
Replaces the entire queue with the provided array. Equivalent to clearing the queue and adding all items at once. The currently playing track will be stopped.
addMediaItemsAt(index, items)
Inserts one or more tracks at the specified zero-based index. Items at and after index are shifted right.
removeMediaItem(index)
Removes the single track at the specified zero-based index.
removeMediaItems(fromIndex, toIndex)
Removes all tracks in the range [fromIndex, toIndex) — inclusive of fromIndex, exclusive of toIndex. This is the Media3-aligned half-open range convention.
moveMediaItem(currentIndex, newIndex)
Moves a track from one position to another in the queue. The indices are zero-based.
clearMediaItems()
Removes all tracks from the queue. Playback stops immediately.
getMediaItems()
Returns a Promise that resolves to the full array of AudioProTrack objects currently in the queue.
seekToMediaItem(index, positionMs?)
Jumps to the track at the specified zero-based index. Optionally accepts a positionMs to start playback at a specific position within that track.
seekToNextMediaItem()
Advances to the next track in the queue. If the current track is the last item and repeat is OFF, this is a no-op.
seekToPreviousMediaItem()
Moves to the previous track in the queue. If the current track is the first item, this is a no-op (or wraps if repeat mode is ALL).
setRepeatMode(mode)
Sets the repeat behavior for queue playback. Accepts 'OFF', 'ONE', or 'ALL'.
| Mode | Behavior |
|---|---|
'OFF' | Play through the queue once, then stop (default) |
'ONE' | Repeat the current track indefinitely |
'ALL' | Loop the entire queue after the last track ends |
setShuffleModeEnabled(enabled)
Enables or disables shuffle mode. When true, the queue plays in a randomised order. The original queue order is preserved and restored when shuffle is disabled.
updateTrack(index, track)
Updates the track at the specified index with a new AudioProTrack object. Useful for refreshing a signed URL before it expires or updating metadata such as the artwork image.
Full Example: Load Queue, Play, and Sync UI
This example loads a playlist, starts playback, and listens forTRACK_CHANGED events to keep the UI in sync with the currently playing track.
Reading Queue State Reactively
TheuseAudioPro() hook exposes activeTrackIndex and queueSize — both updated automatically when QUEUE_CHANGED or TRACK_CHANGED events arrive from native: