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

The SDK is distributed as an NPM package. Install it into your React Native project using either NPM or Yarn, then complete the platform-specific native setup steps described below.

Step 1 — Install the NPM Package

Run one of the following commands from your project root:

npm install enx-rtc-react-native

or, if you use Yarn:

yarn add enx-rtc-react-native

For React Native 0.60 and later, auto-linking handles native module registration automatically — you do not need to run react-native link.

Step 2 — iOS: Configure the Podfile

The SDK depends on Socket.IO-Client-Swift and Starscream for its signalling layer. These libraries must be configured as dynamic frameworks in CocoaPods, otherwise the iOS build will fail. Add the following pre_install block to your ios/Podfile before running pod install:

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('Socket.IO-Client-Swift') || pod.name.eql?('Starscream')
      def pod.build_type
        Pod::BuildType.dynamic_framework
      end
    end
  end
end

After adding the block, install the pods:

cd ios && pod install
Always open the iOS project via the .xcworkspace file that CocoaPods generates, not the original .xcodeproj. Using the wrong file will cause build errors related to missing frameworks.

Step 3 — Android: No Extra Configuration Required

Android requires no additional native configuration. React Native's auto-linking (available since RN 0.60) registers the native Android module automatically when you run npm install. You can proceed directly to building and running your Android project.

Import

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

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

Here is what each export provides:

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.