Skip to main content
Version: Next

Runtime flags

These helpers let you check at runtime which optional native features are compiled into your app. They are synchronous and safe to call from JavaScript after the library has been installed.

Use them to branch UI or loading logic — for example, skip remote metadata preload when FFmpeg is disabled, disable hls streaming, or offer only WAV recording on Android.

Build-time vs runtime

To disable optional libraries at build time (and reduce app size), see Disabling prebuilt libraries. Runtime flags only tell you what ended up in the binary you are running.

isFfmpegEnabled

Returns whether the native build includes FFmpeg. On web, this always returns true — the browser handles decoding.

Returns boolean

Example

import { isFfmpegEnabled } from 'react-native-audio-api';

if (!isFfmpegEnabled()) {
console.warn('Remote URL metadata, streaming, and Android M4A recording require an FFmpeg build.');
}

Where FFmpeg is used

AreaAPIRequires FFmpeg for
StreamingAudio tag, createFileSourceRemote URL streaming (HTTP byte ranges) and HLS (.m3u8)
MetadatagetAudioDuration, <Audio> preload="metadata"Remote http(s): URL duration probing
RecordingAudioRecorder file outputAndroid only: M4A, FLAC, and CAF (WAV uses miniaudio). iOS uses system AVFoundation instead.
File utilsconcatAudioFilesM4A concatenation (WAV uses miniaudio)

Batch decoding (decodeAudioData) uses OS APIs on mobile (and miniaudio for formats like Ogg/Opus) — not FFmpeg. Without FFmpeg, remote progressive sources can still be fully downloaded in JS and decoded that way; HLS and in-place URL streaming remain unavailable.

When isFfmpegEnabled() returns false, the streaming/metadata features in the table above are unavailable or fall back to errors. On Android, AudioRecorder file output is limited to WAV.

Disabling FFmpeg

FFmpeg is enabled by default. To omit it — for example because of symbol clashes with another FFmpeg build in your project — see Disabling prebuilt libraries.