React Native Video SDK

The EnableX React Native SDK (package: enx-rtc-react-native) brings real-time audio and video to cross-platform mobile apps built with React Native. It uses a JSX component-driven approach — you declare the video room as an <EnxRoom> component in your render tree — while imperative actions are called through the Enx API class. The SDK handles all WebRTC internals and signalling; your code focuses on what users see and do.

  View on npm

React Native SDK v2.3.54 — Released February 4, 2026

Prerequisites

Before writing any React Native code, your backend server must have three things in place. These are server-side responsibilities — none of these credentials or operations should ever be performed inside the mobile app itself.

1. App Credentials

Log in to the EnableX Portal and create a project to obtain your app_id and app_key. These credentials authenticate your server when calling the EnableX Video API. Never embed them in the React Native app — treat them as server secrets.

2. A Room

A Room is a virtual session space. Create it via the Video REST API from your server and store the returned room_id. The room persists until you delete it, so you typically create it once per meeting and reuse it across participants.

3. A Token per Participant

Each participant who joins the session needs their own short-lived token. Your server generates the token by calling the Create Token API with the room_id and participant details, then passes it to the React Native app. The app uses this token when connecting to the room via the <EnxRoom> component.

Token generation must always happen server-side. The app_key is required to generate tokens — if it is embedded in the app, it can be extracted and abused to create unauthorized sessions.
Installation

This section walks you through adding enx-rtc-react-native to your own React Native app, from a fresh npm install to a working build on both iOS and Android. Follow the steps in order. The step that matters most is the iOS Podfile configuration — it prevents a static/dynamic framework conflict that otherwise breaks pod install or crashes the app at launch.

Requirements

The plugin has been tested against the versions below. Older toolchains may work, but these are the versions EnableX verifies each release against.

ItemRequirement / Tested Version
Node.js18 or newer (tested with Node 20)
React NativeTested with React Native 0.83.0 and React 19.1.1, New Architecture enabled
Xcode + CocoaPodsLatest Xcode; CocoaPods 1.16 or newer
iOS deployment targetiOS 13.0 minimum (the sample app uses 15.0)
iOS test deviceA real iPhone or iPad — the iOS Simulator is not supported
AndroidminSdkVersion 24, compileSdkVersion / targetSdkVersion 35, Android Gradle Plugin 8.12, Gradle 8.13 (tested)
EnableX accountAn EnableX project and an application server that creates room tokens (see Prerequisites)
No iOS Simulator support. The EnableX iOS SDK ships only a device (arm64) slice, so builds targeting the iOS Simulator fail. This is expected — always test iOS on a physical device.

How the Plugin Is Packaged

The plugin is a thin React Native bridge. The real-time audio and video work is done by the EnableX native SDKs, which in turn depend on WebRTC and Socket.IO. You do not add these native SDKs yourself — they are pulled in automatically when you install the plugin. Understanding what gets pulled in, and how each piece is linked, explains why the iOS setup below looks the way it does.

PlatformComponentVersionHow It Gets into Your AppLinkage
iOSRNEnxRtc (plugin bridge)2.3.54Autolinked from node_modulesStatic (like other RN pods)
iOSEnxRTCiOS3.1.5Dependency of the RNEnxRtc podspecDynamic (prebuilt xcframework)
iOSEnablexWebRTC2.0.2Dependency of EnxRTCiOSDynamic (prebuilt xcframework)
iOSSocket.IO-Client-Swift16.1.1Dependency of the RNEnxRtc podspecMust be dynamic (Podfile hook)
iOSStarscream4.0.8Dependency of Socket.IO-Client-SwiftMust be dynamic (Podfile hook)
AndroidEnxRtcAndroid3.0.3 (.aar)Bundled inside the pluginGradle sub-project
Androidlibwebrtc.aarBundled inside the pluginGradle sub-project
Androidio.socket:socket.io-client2.1.1Downloaded from Maven CentralRegular dependency

Why iOS Needs Mixed Framework Linkage

Android has no such conflict. The native SDK and WebRTC ship as .aar files inside the plugin. You only need to register those two modules in your app's settings.gradle (see Android Step 1).

Install the NPM Package

From the root folder of your React Native project, run:

npm install enx-rtc-react-native --save

or, if you use Yarn:

yarn add enx-rtc-react-native

React Native autolinking detects the plugin on both platforms. Do not run react-native link — it is no longer needed and may create duplicate links.

iOS Setup

iOS setup consists of configuring the Podfile linkage, adding privacy permissions, installing pods, and building on a real device. Complete each step before moving to the next.

Step 1 — Update ios/Podfile

Open ios/Podfile and make it look like the example below. Replace YourAppName with the name of your iOS target (the same name you see in Xcode). Three parts of this file matter:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

# Do NOT use the USE_FRAMEWORKS environment-variable block from the
# default template. Leave it commented out:
# linkage = ENV['USE_FRAMEWORKS']
# if linkage != nil
#   use_frameworks! :linkage => linkage.to_sym
# end

target 'YourAppName' do
  config = use_native_modules!

  # (A) Build all pods as STATIC frameworks
  use_frameworks! :linkage => :static

  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # (B) Build Socket.IO and Starscream as DYNAMIC frameworks
  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if [
        'Socket.IO-Client-Swift',
        'Starscream'
      ].include?(pod.name)
        def pod.build_type
          Pod::BuildType.dynamic_framework
        end
      end
    end
  end

  # (C) Standard React Native post-install + C++20
  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++20'
      end
    end
  end
end
Do not add the native pods manually. Do not add pod 'EnxRTCiOS' or pod 'Socket.IO-Client-Swift' to your Podfile. Both are declared by the plugin's podspec with the exact versions it was built against (EnxRTCiOS 3.1.5, Socket.IO-Client-Swift ~> 16.1.1). Adding them yourself with different versions causes resolution errors.
Do not set USE_FRAMEWORKS=dynamic. Setting this environment variable when running pod install overrides the static linkage set in (A).
Already have hooks? If your Podfile already contains a pre_install or post_install block (for example, from another library), do not add a second one — CocoaPods allows only one of each. Merge the code into your existing block. If another library in your app also needs to be dynamic, add its pod name to the list in hook (B).

Step 2 — Xcode 26 or Newer Only: fmt Build Fix

With Xcode 26, React Native's fmt pod can fail to compile with a call to consteval function ... is not a constant expression error. This is a compiler issue, not an EnableX issue. If you see it, add the following lines inside your post_install block, directly after the react_native_post_install(...) call. Skip this step on older Xcode versions.

fmt_base_h = File.join(installer.sandbox.root, 'fmt/include/fmt/base.h')

if File.exist?(fmt_base_h)
  content   = File.read(fmt_base_h)
  old_guard = '__apple_build_version__ < 14000029L'
  new_guard = '(__apple_build_version__ < 14000029L || __apple_build_version__ >= 21000000L)'

  if content.include?(old_guard) && !content.include?(new_guard)
    File.write(fmt_base_h, content.gsub(old_guard, new_guard))
    Pod::UI.puts 'Patched fmt/base.h for Xcode 26+'
  end
end

Step 3 — Add Camera and Microphone Permissions to Info.plist

iOS requires a usage description for every privacy-sensitive resource your app accesses. Without these keys, iOS terminates the app the first time the camera or microphone is used. Open ios/YourAppName/Info.plist and add:

<key>NSCameraUsageDescription</key>
<string>This app uses the camera for video calls.</string>

<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone for audio and video calls.</string>
Keeping calls alive in the background. If the call must continue while the app is in the background, also enable Signing & Capabilities → Background Modes → Audio, AirPlay, and Picture in Picture in Xcode — and Voice over IP if you use CallKit.

Step 4 — Install the Pods

cd ios
pod install --repo-update
cd ..

At the end of the output, CocoaPods should list RNEnxRtc, EnxRTCiOS, EnablexWebRTC, Socket.IO-Client-Swift, and Starscream among the installed pods.

Step 5 — Verify the Linkage (Recommended)

A quick check in Xcode confirms that the Podfile hooks took effect before you spend time on a full build:

Step 6 — Build and Run on a Real Device

npx react-native run-ios --device
No bridging header needed. You do not need to add a Swift bridging header to your app. New React Native templates already use a Swift AppDelegate, and the plugin's Swift code is compiled inside its own pod.

Android Setup

Android setup consists of registering the bundled native SDK modules, checking SDK levels, enabling AndroidX and Jetifier, and declaring permissions. Unlike iOS, there is no linkage conflict to resolve.

Step 1 — Register the Bundled Native SDKs in android/settings.gradle

The plugin ships the EnableX Android SDK and WebRTC as two local .aar modules, EnxRtcAndroid and LibWebRtc. The plugin depends on them by project name, so your app must include them. Add these lines at the end of android/settings.gradle:

include(":EnxRtcAndroid")
project(":EnxRtcAndroid").projectDir = file('../node_modules/enx-rtc-react-native/android/EnxRtcAndroid')

include(":LibWebRtc")
project(":LibWebRtc").projectDir = file('../node_modules/enx-rtc-react-native/android/LibWebRtc')
This step is mandatory. Without these lines the build fails with Project with path ':EnxRtcAndroid' could not be found. In a monorepo where node_modules is hoisted to a parent folder, adjust the ../node_modules/... path accordingly.

Your complete settings.gradle should look similar to this:

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }

plugins { id("com.facebook.react.settings") }

extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
  ex.autolinkLibrariesFromCommand()
}

rootProject.name = 'YourAppName'

include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

include(":EnxRtcAndroid")
project(":EnxRtcAndroid").projectDir = file('../node_modules/enx-rtc-react-native/android/EnxRtcAndroid')

include(":LibWebRtc")
project(":LibWebRtc").projectDir = file('../node_modules/enx-rtc-react-native/android/LibWebRtc')

Step 2 — Check android/build.gradle

Make sure minSdkVersion is 24 or higher:

buildscript {
    ext {
        minSdkVersion = 24
        compileSdkVersion = 35
        targetSdkVersion = 35
        // ...
    }
}

Step 3 — Enable AndroidX and Jetifier in android/gradle.properties

android.useAndroidX=true
android.enableJetifier=true

Jetifier is required because one of the SDK's transitive libraries still uses the old Android Support packages. Without it, the build fails with duplicate-class errors.

Step 4 — Add Permissions to AndroidManifest.xml

Add the following inside the <manifest> tag of android/app/src/main/AndroidManifest.xml. Bluetooth and network-state permissions are already merged in from the EnableX SDK, so you do not need to add them.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Foreground service: needed for screen share and calls in background -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Android 14 and above. If you target Android 14 (API 34) or higher and keep the call running with the camera or microphone in the background, Android also requires FOREGROUND_SERVICE_CAMERA and FOREGROUND_SERVICE_MICROPHONE.

Step 5 — Request Runtime Permissions Before Joining a Room

On Android 6 and above, camera and microphone permissions must be granted at runtime — declaring them in the manifest is not enough. Ask for them before rendering <EnxRoom>; if the user declines, the session connects with black video or no audio.

import { PermissionsAndroid, Platform } from 'react-native';

async function requestCallPermissions() {
  if (Platform.OS !== 'android') return true;

  const result = await PermissionsAndroid.requestMultiple([
    PermissionsAndroid.PERMISSIONS.CAMERA,
    PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
    PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT,
  ]);

  return Object.values(result).every(
    v => v === PermissionsAndroid.RESULTS.GRANTED,
  );
}

On iOS, the system shows the permission prompts automatically the first time the camera or microphone is used, using the texts from Info.plist.

Step 6 — Build and Run

npx react-native run-android

No changes to MainApplication are needed — EnxRtcPackage is registered automatically by autolinking.

Troubleshooting

Most installation problems trace back to a missed step above. Find the symptom you are seeing, then apply the fix. After changing the Podfile or Gradle files, do a clean reinstall to clear stale build artifacts.

iOS

Android

Both Platforms

Clean Reinstall

When configuration changes do not seem to take effect, clear all cached build output and reinstall:

# iOS
cd ios
rm -rf Pods Podfile.lock build
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod install --repo-update
cd ..

# Android
cd android
./gradlew clean
cd ..

# Metro cache
npx react-native start --reset-cache

Final Checklist

Before you move on to writing session code, confirm every item below.

Both platforms

iOS

Android

Import

At the top of any component that uses the SDK, import the classes you need from the package. A typical session screen uses these four exports:

import { Enx, EnxRoom, EnxStream, EnxPlayerView } from 'enx-rtc-react-native';

Here is what each export provides:

Minimal Example

The example below shows how the components fit together. <EnxRoom> connects to the room with a token created by your application server, <EnxStream> inside it publishes the local stream, and once the local stream ID is known, <EnxPlayerView> renders it on screen.

import { EnxRoom, EnxStream, EnxPlayerView, Enx } from 'enx-rtc-react-native';

// token: room token created by your application server
<EnxRoom
  token={token}
  eventHandlers={roomEventHandlers}
  localInfo={localStreamInfo}
  roomInfo={roomInfo}>
  <EnxStream
    style={{ width: 0, height: 0 }}
    eventHandlers={streamEventHandlers}
  />
</EnxRoom>

{localStreamId ? (
  <EnxPlayerView
    streamId={String(localStreamId)}
    isLocal="local"
    style={{ width: 100, height: 100 }}
  />
) : null}
On Android, call requestCallPermissions() and wait for it to resolve before rendering <EnxRoom>.
Callbacks — How the SDK Notifies Your App

Unlike browser-based SDKs that use addEventListener, the EnableX React Native SDK uses callbacks (also called event handlers) to deliver asynchronous notifications. This is how the SDK tells your app that the room connected, a new participant joined, a stream was added, or any other session event occurred.

You provide your callbacks by passing an eventHandlers prop to the <EnxRoom> component. This prop accepts a plain JavaScript object where each key is a callback name and the corresponding value is the handler function. When an event occurs, the SDK invokes the matching handler and passes an event data object as the argument.

The general pattern looks like this:

const eventHandlers = {
  roomConnected: (data) => {
    console.log('Connected to room:', data);
  },
  streamAdded: (data) => {
    console.log('New stream:', data);
  },
  userDisconnected: (data) => {
    console.log('User left:', data.clientId);
  }
};

<EnxRoom
  token={sessionToken}
  eventHandlers={eventHandlers}
  // ... other props
/>
All callback handlers should be defined before the EnxRoom component mounts. Define them in state or as stable references (useCallback in function components, or class methods in class components) to prevent unnecessary re-renders and ensure the SDK always has a consistent reference to your handlers.

The specific callbacks available for each feature — connection, streams, recording, moderation, and so on — are documented on the relevant topic pages. The pattern above applies universally: all callbacks are delivered through the single eventHandlers prop.

Error Handling

The SDK does not throw exceptions for session-level errors. Instead, it signals failures through dedicated error callbacks. When something goes wrong — connection is refused, an operation is not permitted for your role, or a network issue occurs — the SDK calls the relevant error callback and passes a structured error payload.

The two most common error callbacks to implement are roomError, which fires for room-level failures, and eventError, which fires for failures on specific operations like recording or moderation. Both follow the same payload structure.

The error payload always includes:

A minimal error handler looks like this:

const eventHandlers = {
  roomError: (error) => {
    console.error('Room error:', error.msg, '| Code:', error.result);
  }
};
Always implement at least roomError in your eventHandlers. Without it, silent failures during connection or session setup will be invisible to your app and extremely difficult to debug.

Individual topic pages document additional error callbacks specific to each feature area, such as recording errors, floor access errors, and stream errors.

React Native SDK Documentation

The React Native SDK documentation is organized into the following topics:

🔌
Connecting to a Session
Join and leave a room, manage audio device selection, handle reconnection.
📹
Stream Management
Publish your camera, subscribe to remote streams, manage active talkers, mute, and switch devices.
💬
In-Session Communication
Chat messaging, file sharing, screen sharing, canvas streaming, and annotation.
🎭
Session Management
Recording, room controls, moderation, user roles, and session lifecycle.
🎤
Floor Access Control
Request, grant, deny, and manage floor access in moderated sessions.
🔧
Developer Tools
Live stats, talker notifications, outbound calling, background handling, diagnostics, and logging.