TheDocumentation 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.
AudioPro object is a static class that exposes every method you need to drive playback in React Native Audio Pro. Import it once and call its methods from anywhere in your app — no instantiation required. All methods delegate directly to the native layer, and mutable state is mirrored in the internal Zustand store so the useAudioPro hook always reflects the latest values.
Configuration
configure
play() call.
Global configuration object for the player.
Type of content being played —
'MUSIC' or 'SPEECH'. Defaults to 'MUSIC'.Enable verbose debug logging. Defaults to
false.Include high-frequency progress events in debug logs. Defaults to
false.How often
PROGRESS events fire, in milliseconds. Defaults to 1000.Duration used by skip-forward / skip-back notification buttons, in milliseconds. Defaults to
30000.Default repeat mode:
'OFF', 'ONE', or 'ALL'.Enable shuffle mode by default.
Maximum on-disk cache in bytes. Defaults to 500 MB. Takes effect on first initialization.
Enable or disable track caching. Requires a session restart to take full effect. Defaults to
true.Skip silent sections during playback (Android only). Defaults to
false.void
syncFromNative
STATE_CHANGED, PROGRESS, and TRACK_CHANGED events so the internal store catches up.
Returns: void
Playback Control
play
Optional playback configuration.
Start playing immediately after loading. Defaults to
true.Custom HTTP headers for the audio stream (
headers.audio) and artwork (headers.artwork).Position in milliseconds to seek to before playback begins.
Append the track to the queue instead of replacing it.
void
pause
void
stop
void
seekTo
Target position in milliseconds. Must be
≥ 0.void
seekBy
Offset in milliseconds. Positive = forward, negative = backward.
void
setPlaybackSpeed
Speed multiplier. Clamped to
0.25 – 2.0. Normal speed is 1.0.void
setVolume
Volume level. Clamped to
0.0 (mute) – 1.0 (full).void
setRepeatMode
'OFF' — no repeat. 'ONE' — loop the current track. 'ALL' — loop the entire queue.void
setShuffleModeEnabled
true to enable shuffle, false to disable.void
setSkipSilence
This method is Android only. On iOS it is a no-op.
true to skip silent sections, false to play them normally.void
setProgressInterval
PROGRESS events are emitted without reconfiguring the entire player. Values outside the valid range are clamped.
Interval in milliseconds. Clamped to
100 – 10000.void
Queue Management
addMediaItems
A single track or an array of tracks to append. Invalid items are silently filtered out.
void
setMediaItems
The new queue. Invalid items are silently filtered out.
void
addMediaItemsAt
Zero-based position at which to insert. Items already at this index are shifted right.
Track or tracks to insert.
void
removeMediaItem
Zero-based index of the track to remove.
void
removeMediaItems
[fromIndex, toIndex) — i.e. fromIndex is inclusive and toIndex is exclusive.
Start index (inclusive, zero-based).
End index (exclusive).
void
moveMediaItem
Current zero-based index of the track to move.
Target zero-based index.
void
clearMediaItems
void
getMediaItems
Promise<AudioProTrack[]> — resolves to the current queue.
seekToMediaItem
Zero-based queue index to jump to.
Position in milliseconds to seek to once the track is ready.
void
seekToNextMediaItem
void
seekToPreviousMediaItem
void
updateTrack
Zero-based index of the track to update.
The new track object. Must pass validation; invalid tracks are rejected with a warning.
void
Audio Effects
The following audio-effect methods are Android only. On iOS they are no-ops.
setEqualizer
-10 to +10. Pass one value per band, ordered from 31 Hz to 16 kHz (10 bands total). See EQUALIZER_BANDS for the full band list.
Array of 10 dB gain values, one per EQ band ordered from 31 Hz to 16 kHz.
void
setBassBoost
Bass boost intensity, from
0 (off) to 1000 (maximum).void
Notification
setNotificationButtons
Ordered array of button identifiers to display. Maximum 4 additional buttons (5 total including Play/Pause). Valid values:
'PLAY', 'PAUSE', 'PREV', 'NEXT', 'LIKE', 'DISLIKE', 'SAVE', 'BOOKMARK', 'REWIND_30', 'FORWARD_30'.void
updateNotificationState
Whether the current track is marked as liked.
Whether the current track is marked as disliked.
Whether the current track is bookmarked.
void
Events
addEventListener
.remove() on it to unsubscribe.
Function called for every player event. Receives an
AudioProEvent with type, track, and optional payload.EmitterSubscription
addAmbientListener
Function called for ambient events. Receives an
AudioProAmbientEvent with type ('AMBIENT_TRACK_ENDED' or 'AMBIENT_ERROR') and optional payload.EmitterSubscription
Ambient Audio
Ambient audio plays independently of the main queue — useful for background soundscapes, nature sounds, or meditation backgrounds layered beneath a primary track.ambientPlay
URL of the audio file. Supports
http://, https://, and file:// schemes.Whether to loop the ambient audio. Defaults to
true.void
ambientStop
void
ambientPause
void
ambientResume
void
ambientSeekTo
Target position in milliseconds.
void
ambientSetVolume
Volume level clamped to
0.0 (mute) – 1.0 (full).void
Cache
getCacheSize
Promise<number> — resolves to the cache size in bytes.
clearCache
Promise<boolean> — resolves to true when the cache was cleared successfully.
Sleep Timer
startSleepTimer
SLEEP_TIMER_COMPLETE event when triggered.
Number of seconds to wait before pausing.
void
cancelSleepTimer
void
State Getters
These methods read directly from the internal store and return synchronously — no async/await required.For reactive state in React components, use the
useAudioPro hook instead of calling these in render. Reserve state getters for callbacks, event handlers, and non-React code.getTimings
{ position: number; duration: number } — both values in milliseconds.
getPlaybackState
AudioProState — one of 'IDLE', 'STOPPED', 'LOADING', 'PLAYING', 'PAUSED', or 'ERROR'.
getCurrentMediaItem
null if the queue is empty.
Returns: AudioProTrack | null
getCurrentMediaItemIndex
-1 if no track is active.
Returns: number
getPlaybackSpeed
number — between 0.25 and 2.0.
getVolume
number — between 0.0 and 1.0.
getError
null if the last operation succeeded.
Returns: AudioProPlaybackErrorPayload | null
getProgressInterval
number — interval in milliseconds.