Skip to main content
Version: Next

Prebuilt libraries support

react-native-audio-api can link a number of prebuilt third-party libraries that are downloaded at build time. They enable additional decoding and streaming features, but also add several megabytes to the resulting application binary, so each one can be toggled with a build flag.

Library setDefaultFlagWhat it adds
FFmpeg (libavcodec, libavformat, libavutil, libswresample)offenableFFmpegRemote URL streaming (HTTP byte ranges), HLS (.m3u8), remote URL metadata — see Runtime flags.
Static libs (libopus, libopusfile, libogg, libvorbis, libvorbisenc, libvorbisfile)ondisableStaticExternalLibsDecoding ogg, opus, oga files

The flags are independent and can be combined.

FFmpeg is opt-in

Apps that would like to decode HLS or make use of URL streaming have to enable it explicitly (see below). Use isFfmpegEnabled to branch at runtime.

Enabling FFmpeg​

Add an entry in the Audio API Expo plugin configuration:

"enableFFmpeg": true

With FFmpeg enabled, the FFmpeg binaries are downloaded during pod install / the first Gradle build and linked into the app. FFmpeg is distributed under the LGPL — see THIRD_PARTY.md in the repository for the notice that applies to FFmpeg-enabled builds.

Disabling other external libraries​

This removes the bundled Opus / Ogg / Vorbis static libraries. With this flag enabled, attempts to decode .ogg, .opus, or .oga files through AudioContext.decodeAudioData (or any other decoding path) will return an error — those formats are handled inside miniaudio via the now-disabled custom backends.

Add an entry in the Audio API Expo plugin configuration:

"disableStaticExternalLibs": true