Getting Started
Installation
The library requires React Native 0.76 or newer (with the New Architecture enabled) and React 18.2+, and runs on iOS 16+ and Android API 24+. Building for iOS needs Xcode 26.4 or later (Swift 6.3): Swift 6.2 has a bug that makes the library crash on iOS below 18, so the library refuses to compile with it. react-native-nitro-modules 0.35 or later is a required peer dependency — install it alongside:
npm install react-native-audio-browser react-native-nitro-modulesyarn add react-native-audio-browser react-native-nitro-modulespnpm add react-native-audio-browser react-native-nitro-modulesbun add react-native-audio-browser react-native-nitro-modulesOn iOS, install the pods:
cd ios && pod installFor playback to continue in the background on iOS, add the audio background mode to your app's Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>Android links automatically.
For web (react-native-web), also install shaka-player 4 (4.7.9 or later). It is an optional peer dependency that the web player loads during setupPlayer(). Native builds don't need it.
npm install shaka-playeryarn add shaka-playerpnpm add shaka-playerbun add shaka-playerBasic Setup
import { setupPlayer } from 'react-native-audio-browser'
// Initialize the player once at startup
await setupPlayer()The library exposes both named exports (
import { setupPlayer }) and a default namespace (import AudioBrowser from '…'; AudioBrowser.setupPlayer()). The guides use the named form throughout.
Web
The same API runs in the browser. On web the library plays through an HTML <audio> element driven by Shaka Player, the optional peer dependency from Installation.
Your bundler must resolve .web.ts / .web.js files ahead of plain ones, as react-native-web setups do, and map react-native to react-native-web. On the server (no window) setupPlayer() creates no player, so call it in the browser.
Playback, the queue, browse, search and the sleep timer work as on native. Now Playing metadata goes to the browser's Media Session API, so the system's media controls, media keys and Bluetooth buttons show the track and drive the player through the same remote controls handlers.
What web lacks:
- No CarPlay or Android Auto: the Gate does nothing and
isCarConnected()is alwaysfalse. - The equalizer, battery and audio output APIs return their empty values (
undefined,false,'unrestricted') and their setters do nothing.getSystemVolume()is always1andsetSystemVolume()does nothing. - No automatic retry (manual
retry()works) and no timed metadata, neither ICY nor HLS ID3; see Live Streams.
Next Steps
- Basic Usage - Learn how to play audio and build navigation trees
- Android Auto - Set up Android Auto integration
- CarPlay - Set up CarPlay integration