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 or hide an HLS source when FFmpeg is not part of the build.

Build-time vs runtime

Optional libraries are chosen at build time — see Prebuilt libraries support. Runtime flags only tell you what ended up in the binary you are running.

isFfmpegEnabled​

Returns whether the native build includes FFmpeg. FFmpeg is off by default and returns false unless the app enabled it. 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 and streaming 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

Without FFmpeg, remote progressive sources are fully downloaded in JS and decoded that way; preload="metadata" behaves like none; HLS sources fail with a NotSupportedError.

Enabling FFmpeg​

FFmpeg is disabled by default to keep the app binary small and to leave the LGPL notice to apps that actually ship FFmpeg. To turn it on, see Prebuilt libraries support.