features/player
AndroidAudioContentType
type AndroidAudioContentType = "music" | "speech" | "sonification" | "movie" | "unknown";AndroidAudioContentType options:
'music': Content type value to use when the content type is music. See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_MUSIC'speech': Content type value to use when the content type is speech. See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_SPEECH'sonification': Content type value to use when the content type is a sound used to accompany a user action, such as a beep or sound effect expressing a key click, or event, such as the type of a sound for a bonus being received in a game. These sounds are mostly synthesized or short Foley sounds. See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_SONIFICATION'movie': Content type value to use when the content type is a soundtrack, typically accompanying a movie or TV program.'unknown': Content type value to use when the content type is unknown, or other than the ones defined. See https://developer.android.com/reference/android/media/AudioAttributes#CONTENT_TYPE_UNKNOWN
AndroidAudioOffloadSettings
Properties
AndroidOptions
Properties
| Property | Type | Description |
|---|---|---|
appKilledPlaybackBehavior | AppKilledPlaybackBehavior | Whether the audio playback notification is also removed when the playback stops. If stoppingAppPausesPlayback is set to false, this will be ignored. |
skipSilence | boolean | Whether to automatically skip silent audio segments during playback. When enabled, the player will detect and skip over periods of silence. Default false |
shuffle | boolean | Whether shuffle mode is enabled for queue playback. When enabled, tracks will be played in random order. Default false |
ratingType | RatingType | The rating type to use for ratings. Determines how star ratings and thumbs up/down are handled. |
notificationButtons | NotificationButtonLayout | null | Slot-based button layout for Android notifications. Provides explicit control over which buttons appear in which positions. When not specified, button layout is derived from capabilities. Platform android |
AndroidPlayerWakeMode
type AndroidPlayerWakeMode = "none" | "local" | "network";AndroidWakeMode options:
'none': No wake locks are held. The device may go to sleep during playback.'local': Holds a PowerManager.WakeLock during playback to prevent CPU sleep. Suitable for local media playback with the screen off.'network': Holds both PowerManager.WakeLock and WifiManager.WifiLock during playback. Suitable for streaming media over WiFi with the screen off.
AndroidSetupPlayerOptions
Properties
| Property | Type | Description |
|---|---|---|
minBuffer | number | Minimum duration of media that the player will attempt to buffer in ms. Throws Will throw if min buffer is higher than max buffer. Default 50000 |
audioOffload | boolean | AndroidAudioOffloadSettings | Audio offload configuration for power-efficient playback. - true: Enable with default settings (gapless and rate change support required) - false: Disable audio offload - { gaplessSupportRequired?, rateChangeSupportRequired? }: Enable with custom requirements Audio offload moves audio processing to dedicated hardware when available, saving battery during longer playbacks, especially with screen off. Requirements determine which features must be supported for offload to activate: - gaplessSupportRequired: Smooth track transitions without silence - rateChangeSupportRequired: Variable playback speeds (0.5x, 1.25x, 2x, etc.) See https://developer.android.com/media/media3/exoplayer/track-selection#audioOffload |
maxBuffer | number | Maximum duration of media that the player will attempt to buffer in ms. Max buffer may not be lower than min buffer. Throws Will throw if max buffer is lower than min buffer. Default 50000 |
backBuffer | number | Duration in ms that should be kept in the buffer behind the current playhead time. Default 0 |
playBuffer | number | Duration of media in ms that must be buffered for playback to start or resume following a user action such as a seek. Default 2500 |
rebufferBuffer | number | null | Duration of media in ms that must be buffered for playback to resume after a rebuffer (when the buffer runs empty during playback). When null (the default), uses automatic mode: - Starts at playBuffer value - On rebuffer, measures how fast the buffer drained - Calculates how much buffer is needed to sustain 60s of playback - Increases threshold accordingly (up to 8000ms max) - Resets when changing tracks Set to a number for a fixed threshold in ms. Should be >= playBuffer, otherwise playback may rebuffer repeatedly (resuming with less buffer than initial start). Default null (automatic) |
maxCacheSize | number | Maximum cache size in MB. Default 0 |
audioContentType | AndroidAudioContentType | The audio content type indicates to the android system how you intend to use audio in your app. With audioContentType: AndroidAudioContentType.Speech, the audio will be paused during short interruptions, such as when a message arrives. Otherwise the playback volume is reduced while the notification is playing. Default AndroidAudioContentType.Music |
handleAudioBecomingNoisy | boolean | Whether the player should automatically pause when audio becomes noisy (e.g., when headphones are unplugged). Default true |
wakeMode | AndroidPlayerWakeMode | Wake mode for the player to use. Determines whether wake locks are held to keep the CPU and/or WiFi active during playback. Default 'none' |
AndroidUpdateOptions
Properties
| Property | Type | Description |
|---|---|---|
appKilledPlaybackBehavior? | AppKilledPlaybackBehavior | Whether the audio playback notification is also removed when the playback stops. If stoppingAppPausesPlayback is set to false, this will be ignored. |
skipSilence? | boolean | Whether to automatically skip silent audio segments during playback. When enabled, the player will detect and skip over periods of silence. Default false |
shuffle? | boolean | Whether shuffle mode is enabled for queue playback. When enabled, tracks will be played in random order. Default false |
ratingType? | RatingType | The rating type to use for ratings. Determines how star ratings and thumbs up/down are handled. |
notificationButtons? | NotificationButtonLayout | null | Slot-based button layout for Android notifications. Provides explicit control over which buttons appear in which positions. When not specified, button layout is derived from capabilities. Platform android |
AppKilledPlaybackBehavior
type AppKilledPlaybackBehavior =
| "continue-playback"
| "pause-playback"
| "stop-playback-and-remove-notification";AppKilledPlaybackBehavior options:
'continue-playback': This option will continue playing audio in the background when the app is removed from recents. The notification remains. This is the default.'pause-playback': This option will pause playing audio in the background when the app is removed from recents. The notification remains and can be used to resume playback.'stop-playback-and-remove-notification': This option will stop playing audio in the background when the app is removed from recents. The notification is removed and can't be used to resume playback. Users would need to open the app again to start playing audio.
FeedbackOptions
Properties
| Property | Type | Description |
|---|---|---|
isActive | boolean | Marks wether the option should be marked as active or "done" |
title | string | The title to give the action (relevant for iOS) |
IOSCategory
type IOSCategory =
| "playback"
| "playAndRecord"
| "multiRoute"
| "ambient"
| "soloAmbient"
| "record";IOSCategory options:
'playback': The category for playing recorded music or other sounds that are central to the successful use of your app. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback'playAndRecord': The category for recording (input) and playback (output) of audio, such as for a Voice over Internet Protocol (VoIP) app. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord'multiRoute': The category for routing distinct streams of audio data to different output devices at the same time. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute'ambient': The category for an app in which sound playback is nonprimary — that is, your app also works with the sound turned off. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient'soloAmbient': The default audio session category. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient'record': The category for recording audio while also silencing playback audio. See https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record
IOSCategoryMode
type IOSCategoryMode =
| "default"
| "gameChat"
| "measurement"
| "moviePlayback"
| "spokenAudio"
| "videoChat"
| "videoRecording"
| "voiceChat"
| "voicePrompt";IOSCategoryMode options:
'default': The default audio session mode. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default'gameChat': A mode that the GameKit framework sets on behalf of an application that uses GameKit's voice chat service. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat'measurement': A mode that indicates that your app is performing measurement of audio input or output. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement'moviePlayback': A mode that indicates that your app is playing back movie content. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback'spokenAudio': A mode used for continuous spoken audio to pause the audio when another app plays a short audio prompt. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio'videoChat': A mode that indicates that your app is engaging in online video conferencing. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat'videoRecording': A mode that indicates that your app is recording a movie. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording'voiceChat': A mode that indicates that your app is performing two-way voice communication, such as using Voice over Internet Protocol (VoIP). See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat'voicePrompt': A mode that indicates that your app plays audio using text-to-speech. See https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt
IOSCategoryOptions
type IOSCategoryOptions =
| "mixWithOthers"
| "duckOthers"
| "interruptSpokenAudioAndMixWithOthers"
| "allowBluetooth"
| "allowBluetoothA2DP"
| "allowAirPlay"
| "defaultToSpeaker";IOSCategoryOptions options:
'mixWithOthers': An option that indicates whether audio from this session mixes with audio from active sessions in other audio apps. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers'duckOthers': An option that reduces the volume of other audio sessions while audio from this session plays. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers'interruptSpokenAudioAndMixWithOthers': An option that determines whether to pause spoken audio content from other sessions when your app plays its audio. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot'allowBluetooth': An option that determines whether Bluetooth hands-free devices appear as available input routes. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth'allowBluetoothA2DP': An option that determines whether you can stream audio from this session to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP). See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp'allowAirPlay': An option that determines whether you can stream audio from this session to AirPlay devices. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay'defaultToSpeaker': An option that determines whether audio from the session defaults to the built-in speaker instead of the receiver. See https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616462-defaulttospeaker
IOSCategoryPolicy
type IOSCategoryPolicy = "default" | "longFormAudio" | "longFormVideo";IOSCategoryPolicy options:
'default': See https://developer.apple.com/documentation/avfoundation/avaudiosession/routesharingpolicy/default'longFormAudio': See https://developer.apple.com/documentation/avfoundation/avaudiosession/routesharingpolicy/longformaudio'longFormVideo': See https://developer.apple.com/documentation/avfoundation/avaudiosession/routesharingpolicy/longformvideo
IOSSetupPlayerOptions
Properties
| Property | Type | Description |
|---|---|---|
buffer? | number | Preferred forward buffer duration in ms. When set to 0 (default), AVPlayer chooses an appropriate level of buffering automatically. Setting this to a value greater than 0 disables automaticallyWaitsToMinimizeStalling. Read more from Apple Documentation Default 0 |
category? | IOSCategory | AVAudioSession.Category for iOS. Sets on play(). |
categoryMode? | IOSCategoryMode | The audio session mode, together with the audio session category, indicates to the system how you intend to use audio in your app. You can use a mode to configure the audio system for specific use cases such as video recording, voice or video chat, or audio analysis. Sets on play(). See https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode |
categoryOptions? | IOSCategoryOptions[] | AVAudioSession.CategoryOptions for iOS. Sets on play(). |
categoryPolicy? | IOSCategoryPolicy | AVAudioSession.RouteSharingPolicy for iOS. Sets on play(). |
NativeUpdateOptions
Properties
| Property | Type | Description |
|---|---|---|
android? | NitroAndroidUpdateOptions | Android-specific configuration options |
forwardJumpInterval? | number | Jump forward interval in seconds when using jump forward controls. Default 15 |
backwardJumpInterval? | number | Jump backward interval in seconds when using jump backward controls. Default 15 |
progressUpdateEventInterval? | number | null | How often progress events are emitted in seconds. When null, progress events are disabled. Default null |
capabilities? | PlayerCapabilities | - |
iosPlaybackRates? | number[] | Supported playback rates for the playback-rate capability. Platform ios |
NitroAndroidUpdateOptions
Properties
| Property | Type |
|---|---|
appKilledPlaybackBehavior? | AppKilledPlaybackBehavior |
skipSilence? | boolean |
shuffle? | boolean |
ratingType? | RatingType |
notificationButtons? | NotificationButtonLayout | null |
NotificationButton
type NotificationButton =
| "skip-to-previous"
| "skip-to-next"
| "jump-backward"
| "jump-forward"
| "favorite";Buttons that can be assigned to Android notification button slots. These represent the interactive buttons users can tap in the notification.
NotificationButtonLayout
type NotificationButtonLayout = object;Configuration for notification button layout on Android. Allows explicit control over which buttons appear in which slots.
Slot behavior:
- Omit a slot: Derive from capabilities (smart default)
- Set to null: Explicitly empty slot
- Set to button: Show that button in that slot
Example
// Podcast-style: jump buttons as primary
notificationButtons: {
back: 'jump-backward',
forward: 'jump-forward',
overflow: ['favorite']
}
// Music-style: skip as primary, jump as secondary
notificationButtons: {
back: 'skip-to-previous',
forward: 'skip-to-next',
backSecondary: 'jump-backward',
forwardSecondary: 'jump-forward'
}Properties
back?
optional back: NotificationButton | null;Primary back position (SLOT_BACK) - typically previous track or jump backward
forward?
optional forward: NotificationButton | null;Primary forward position (SLOT_FORWARD) - typically next track or jump forward
backSecondary?
optional backSecondary: NotificationButton | null;Secondary back position (SLOT_BACK_SECONDARY)
forwardSecondary?
optional forwardSecondary: NotificationButton | null;Secondary forward position (SLOT_FORWARD_SECONDARY)
overflow?
optional overflow: NotificationButton[];Additional buttons in overflow area (SLOT_OVERFLOW)
useOptions()
function useOptions(): Options;Hook that returns the current player options and updates when they change.
Returns
The current player options
getOptions()
function getOptions(): Options;Gets the current player options with resolved defaults. Returns all current option values - use this to read the current state.
Returns
The current player options with all properties resolved to their current values
Example
const options = getOptions();
if (options.repeatMode === 'track') {
// Handle track repeat mode
}updateOptions()
function updateOptions(options): void;Updates the configuration for the components. Pass only the properties you want to change - all properties are optional.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | UpdateOptions | The partial options to update. Only changed properties need to be specified. |
Returns
void
See
getOptions to get current options
Example
// Update single property
updateOptions({ repeatMode: 'track' });
// Disable specific capabilities
updateOptions({
capabilities: { shuffleMode: false },
progressUpdateEventInterval: 0.5
});onOptionsChanged
const onOptionsChanged: NativeUpdatedValue<Options>;Subscribes to player options changes.
Param
Called when the player options change
Returns
Cleanup function to unsubscribe
Options
Current player options with resolved defaults. This is what you receive from getOptions() - all properties are present with their current values. Platform-specific properties (android/ios) are only available on their respective platforms.
Example
const options = getOptions();
console.log(options.repeatMode); // 'off'
console.log(options.capabilities); // { shuffleMode: false } - only disabled caps shown
console.log(options.android?.skipSilence); // true (Android only)
console.log(options.ios?.likeOptions); // { isActive: false, title: 'Like' } (iOS only)Properties
| Property | Type | Description |
|---|---|---|
android? | AndroidOptions | Android-specific configuration options with resolved defaults (only present on Android) |
forwardJumpInterval | number | Jump forward interval in seconds when using jump forward controls. Default 15 |
backwardJumpInterval | number | Jump backward interval in seconds when using jump backward controls. Default 15 |
progressUpdateEventInterval | number | null | How often progress events are emitted in seconds. When null, progress events are disabled. Default null |
capabilities | PlayerCapabilities | The capabilities that the player has. All capabilities are enabled by default - this shows which ones are disabled. |
repeatMode | RepeatMode | The current repeat mode of the player. Default RepeatMode.Off |
PartialAndroidSetupPlayerOptions
type PartialAndroidSetupPlayerOptions = object;Android-specific player setup options.
Properties
minBuffer?
optional minBuffer: number;Minimum duration of media that the player will attempt to buffer in ms.
Throws
Will throw if min buffer is higher than max buffer.
Default
50000audioOffload?
optional audioOffload: boolean | AndroidAudioOffloadSettings;Enable audio offload for power-efficient playback.
When enabled, audio decoding is offloaded to dedicated hardware, reducing CPU usage and extending battery life during long playback sessions.
true: Enable with default settings (gapless + rate change support required)false/undefined: Disabled{ gaplessSupportRequired: boolean, rateChangeSupportRequired: boolean }: Enable with specific requirements for gapless playback and playback rate changes
Default
falsemaxBuffer?
optional maxBuffer: number;Maximum duration of media that the player will attempt to buffer in ms. Max buffer may not be lower than min buffer.
Throws
Will throw if max buffer is lower than min buffer.
Default
50000backBuffer?
optional backBuffer: number;Duration in ms that should be kept in the buffer behind the current playhead time.
Default
0playBuffer?
optional playBuffer: number;Duration of media in ms that must be buffered for playback to start or resume following a user action such as a seek.
Default
2500rebufferBuffer?
optional rebufferBuffer: number | null;Duration of media in ms that must be buffered for playback to resume after a rebuffer (when the buffer runs empty during playback).
When null (the default), uses automatic mode:
- Starts at
playBuffervalue - On rebuffer, measures how fast the buffer drained
- Calculates how much buffer is needed to sustain 60s of playback
- Increases threshold accordingly (up to 8000ms max)
- Resets when changing tracks
Set to a number for a fixed threshold in ms. Should be >= playBuffer, otherwise playback may rebuffer repeatedly (resuming with less buffer than initial start).
Default
null (automatic)maxCacheSize?
optional maxCacheSize: number;Maximum cache size in MB.
Default
0audioContentType?
optional audioContentType: AndroidAudioContentType;The audio content type indicates to the android system how you intend to use audio in your app.
With audioContentType: AndroidAudioContentType.Speech, the audio will be paused during short interruptions, such as when a message arrives. Otherwise the playback volume is reduced while the notification is playing.
Default
AndroidAudioContentType.MusichandleAudioBecomingNoisy?
optional handleAudioBecomingNoisy: boolean;Whether the player should automatically pause when audio becomes noisy (e.g., when headphones are unplugged).
Default
truewakeMode?
optional wakeMode: AndroidPlayerWakeMode;Wake mode for the player to use.
Determines whether wake locks are held to keep the CPU and/or WiFi active during playback.
Default
'none'PartialIOSSetupPlayerOptions
Properties
| Property | Type | Description |
|---|---|---|
buffer? | number | Preferred forward buffer duration in ms. When set to 0 (default), AVPlayer chooses an appropriate level of buffering automatically. Setting this to a value greater than 0 disables automaticallyWaitsToMinimizeStalling. Read more from Apple Documentation Default 0 |
category? | IOSCategory | AVAudioSession.Category for iOS. Sets on play(). |
categoryMode? | IOSCategoryMode | The audio session mode, together with the audio session category, indicates to the system how you intend to use audio in your app. You can use a mode to configure the audio system for specific use cases such as video recording, voice or video chat, or audio analysis. Sets on play(). See https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode |
categoryOptions? | IOSCategoryOptions[] | AVAudioSession.CategoryOptions for iOS. Sets on play(). |
categoryPolicy? | IOSCategoryPolicy | AVAudioSession.RouteSharingPolicy for iOS. Sets on play(). |
PartialSetupPlayerOptions
Properties
| Property | Type | Description |
|---|---|---|
android? | PartialAndroidSetupPlayerOptions | Android-specific configuration options for setup |
ios? | PartialIOSSetupPlayerOptions | iOS-specific configuration options for setup |
autoUpdateMetadata? | boolean | Indicates whether the player should automatically update now playing metadata data in control center / notification. Defaults to true. |
retry? | boolean | RetryConfig | Retry policy for load errors (network failures, timeouts, etc.) - true: Retry indefinitely with exponential backoff (2 minute timeout) - false/undefined: No automatic retry (default) - { maxRetries: n }: Retry up to n times with exponential backoff - { maxRetries: n, maxRetryDurationMs: m }: Retry with custom timeout Exponential backoff delays: 1s → 1.5s → 2.3s → 3.4s → 5s (capped) Default false |
PlayerCapabilities
Player capabilities control which media controls are available to the user. All capabilities are enabled by default - only specify ones you want to disable.
Example
// Disable shuffle and repeat for a simple player
updateOptions({
capabilities: {
shuffleMode: false,
repeatMode: false,
}
})Properties
PlayerOptions
Properties
| Property | Type | Description |
|---|---|---|
android? | AndroidSetupPlayerOptions | Android-specific configuration options for setup |
ios? | PartialIOSSetupPlayerOptions | iOS-specific configuration options for setup |
autoUpdateMetadata | boolean | Indicates whether the player should automatically update now playing metadata data in control center / notification. Defaults to true. |
retry? | boolean | RetryConfig | Retry policy for load errors (network failures, timeouts, etc.) - true: Retry indefinitely with exponential backoff (2 minute timeout) - false/undefined: No automatic retry (default) - { maxRetries: n }: Retry up to n times with exponential backoff - { maxRetries: n, maxRetryDurationMs: m }: Retry with custom timeout Exponential backoff delays: 1s → 1.5s → 2.3s → 3.4s → 5s (capped) Default false |
RetryConfig
type RetryConfig = object;Configuration for retry behavior.
Properties
maxRetries
maxRetries: number;Maximum number of retry attempts before giving up.
maxRetryDurationMs?
optional maxRetryDurationMs: number;Maximum duration in milliseconds to keep retrying before giving up. This prevents surprising playback resumption after long periods offline.
Default
120000 (2 minutes)setupPlayer()
function setupPlayer(options): Promise<void>;Initializes the player with the specified options.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | PartialSetupPlayerOptions | The options to initialize the player with. |
Returns
Promise<void>
UpdateOptions
Partial options for updating player configuration. Only specify the properties you want to change - all properties are optional. Use null to reset properties to their defaults.
Example
// Update only repeat mode
updateOptions({ repeatMode: 'track' });
// Disable specific capabilities
updateOptions({
capabilities: { shuffleMode: false, repeatMode: false }
});
// Disable progress events by setting to null
updateOptions({
progressUpdateEventInterval: null
});
// Platform-specific options
updateOptions({
android: { skipSilence: true },
ios: { likeOptions: { isActive: true, title: 'Love' } }
});Properties
| Property | Type | Description |
|---|---|---|
android? | AndroidUpdateOptions | Android-specific configuration options |
forwardJumpInterval? | number | Jump forward interval in seconds when using jump forward controls. Default 15 |
backwardJumpInterval? | number | Jump backward interval in seconds when using jump backward controls. Default 15 |
progressUpdateEventInterval? | number | null | How often progress events are emitted in seconds. When null, progress events are disabled. Default null |
capabilities? | PlayerCapabilities | Player capabilities to enable or disable. All capabilities are enabled by default - only specify ones you want to disable. Example // Disable shuffle and repeat updateOptions({ capabilities: { shuffleMode: false, repeatMode: false, } }) |
iosPlaybackRates? | number[] | Supported playback rates for the playback-rate capability. Used by CarPlay and lock screen rate controls. Platform ios Default [0.5, 1.0, 1.5, 2.0] |