nimeet Docs
中文

React Native SDK Guide

React Native bridge, install, join and events.

Interface sections generated from the public SDK definitions

Version v1.1.0 · Updated 2026-10-26 · revision 1

The React Native SDK has the RtcEngine + IRtcEngineEventHandler shape and is exposed to JS through a native bridge (Kotlin/Java on Android, Objective-C on iOS).

Prerequisites

  • React Native 0.74+, Node.js ≥ 22, Xcode 16+ / Android SDK 35.
  • Android needs the CAMERA and RECORD_AUDIO runtime permissions; iOS needs NSCameraUsageDescription / NSMicrophoneUsageDescription.
  • An appId and a token service (see Enable Services and Get Credentials).

Installation

bash
# planned package name, not published to npm yet
npm install react-native-nimeet-rtc
cd ios && pod install

Expo projects need a prebuild (npx expo prebuild) before the native module can be added.

Get a token

Your backend issues the token (POST /v1/tokens), and the RN side only keeps { appId, rtcToken, rtcUid }; never bundle customerSecret into the JS bundle.

typescript
const { appId, rtcToken, rtcUid } = await fetch('/api/rtc-token?channel=weekly-sync&uid=10001').then(r => r.json());

Join a channel

typescript
import {
  createAgoraRtcEngine,
  ChannelProfileType,
  ClientRoleType,
  IRtcEngineEventHandler,
} from 'react-native-nimeet-rtc';

const engine = createAgoraRtcEngine();

const handler: IRtcEngineEventHandler = {
  onJoinChannelSuccess: (connection, elapsed) => console.log('joined', connection.channelId),
  onUserJoined: (connection, remoteUid, elapsed) => console.log('remote joined', remoteUid),
  onUserOffline: (connection, remoteUid, reason) => console.log('remote left', remoteUid),
  onTokenPrivilegeWillExpire: () => refreshToken(),
  onError: (err) => console.warn('rtc error', err),
};

engine.initialize({ appId, logConfig: { level: 1 } });
engine.registerEventHandler(handler);
engine.setChannelProfile(ChannelProfileType.ChannelProfileLiveBroadcasting);
engine.enableVideo();
engine.startPreview();

engine.joinChannel(rtcToken, 'weekly-sync', rtcUid, {
  clientRoleType: ClientRoleType.ClientRoleBroadcaster,
});

Publishing and subscribing

typescript
engine.muteLocalAudioStream(true);
engine.muteLocalVideoStream(true);
engine.enableLocalVideo(false);
engine.updateChannelMediaOptions({ clientRoleType: ClientRoleType.ClientRoleAudience });

Screen sharing relies on native capability: MediaProjection (with a foreground service) on Android, a Broadcast Upload Extension on iOS; the method names are in this platform's API reference (startScreenCapture, getScreenCaptureSources and so on).

Events

An IRtcEngineEventHandler is a plain object: fill in the methods you need. The common ones: onJoinChannelSuccess, onUserJoined, onUserOffline, onFirstRemoteVideoDecoded, onTokenPrivilegeWillExpire, onError, onConnectionStateChanged.

Error handling

  • Synchronous methods return a numeric error code; 0 means success and a negative value is an Agora error number;
  • Asynchronous errors arrive through onError;
  • Unimplemented capabilities return -4 (ERR_NOT_SUPPORTED).

Troubleshooting

SymptomCauseHandling
TurboModule errorThe version is not adapted to the new architectureCheck the RN version against the package support matrix
iOS build failsPods are not installedcd ios && pod install
Black screen on AndroidMissing runtime permissionsRequest CAMERA / RECORD_AUDIO
No events after a hot reloadThe handler was not registered againRegister when the component mounts and call unregisterEventHandler on unmount
Expo Go crashesExpo Go does not contain the native moduleUse a dev client / prebuild

Next steps

Platform information

Itemvalue
PlatformReact Native
LanguageTypeScript / Java / Objective-C
SDK packagereact-native-nimeet-rtc
Interface version4.6.4
Compatible Agora APIAgora rn API

The public interfaces are aligned with the Agora rn API; installation and runtime requirements are listed under Prerequisites above.

Availability

This platform's SDK: Generally available. The examples use the public API; runtime capability follows the published SDK package.

join-channel flow

The method names, parameter types and return values match the API reference for the same platform. Where a method has several overloads, the most common one is shown here; see the API reference for all overloads.

StepInterfaceMethodOverload count
subscribe to remote mediaIBaseSpatialAudioEnginemuteRemoteAudioStream1
Create instance / initializeILocalSpatialAudioEngineinitialize1
Renew the TokenIMusicContentCenterrenewToken1
enable video and local previewIRtcEngineenableVideo1
Join a channelIRtcEnginejoinChannel1
Leave a channelIRtcEngineleaveChannel1
Channel scenariosIRtcEnginesetChannelProfile1
switch rolesIRtcEnginesetClientRole1
typescript
muteRemoteAudioStream(uid: number, mute: boolean): number
initialize(): number
renewToken(token: string): number
enableVideo(): number
joinChannel(token: string, channelId: string, uid: number, options: ChannelMediaOptions): number
leaveChannel(options?: LeaveChannelOptions): number
setChannelProfile(profile: ChannelProfileType): number
setClientRole(role: ClientRoleType, options?: ClientRoleOptions): number

Events and callbacks

Callbacks are registered on IRtcEngineEventHandler; naming differs by platform, and the full list is in the API reference for the same platform.

CallbacksSignaturePurpose
onConnectionStateChangedonConnectionStateChanged(connection: RtcConnection, state: ConnectionStateType, reason: ConnectionChangedReasonType): voidjoin result / connection-state changes:update the UI accordingly and decide whether to reconnect.
onUserJoinedonUserJoined(connection: RtcConnection, remoteUid: number, elapsed: number): voidRemote user joined:allocate the frame container.
onFirstRemoteVideoDecodedonFirstRemoteVideoDecoded(connection: RtcConnection, remoteUid: number, width: number, height: number, elapsed: number): voidRemote video status:it can render once the first frame is decoded.
onUserOfflineonUserOffline(connection: RtcConnection, remoteUid: number, reason: UserOfflineReasonType): voidRemote user left:release the container and subscription.
onRequestTokenonRequestToken(connection: RtcConnection): voidToken expiring soon:call the server to renew, then `renewToken`.
onErroronError(err: ErrorCodeType, msg: string): voidRuntime errors:`err` is an Agora error number, route by the error-code table.
onNetworkQualityonNetworkQuality(connection: RtcConnection, remoteUid: number, txQuality: QualityType, rxQuality: QualityType): voidNetwork quality:report to Analytics or prompt the user.

Error codes

Constantvalue
ErrAborted20
ErrAdmGeneralError1005
ErrAdmInitPlayout1008
ErrAdmInitRecording1011
ErrAdmStartPlayout1009
ErrAdmStartRecording1012
ErrAdmStopPlayout1010
ErrAdmStopRecording1013
ErrAlreadyInUse19
ErrBitrateLimit115
ErrBufferTooSmall6
ErrCertRaw1001
ErrClientIsBannedByServer123
ErrConnectionInterrupted111
ErrConnectionLost112
ErrDatastreamDecryptionFailed122
ErrDecryptionFailed120
ErrEncryptedStreamNotAllowedPublish130
ErrFailed1
ErrInitNetEngine21
ErrInvalidAppId101
ErrInvalidArgument2
ErrInvalidChannelName102
ErrInvalidState8
ErrInvalidTokennull
ErrInvalidUserAccount134
ErrInvalidUserId121
ErrJoinChannelRejected17
ErrLeaveChannelRejected18
ErrNoPermission9
ErrNoServerResources103
ErrNotInChannel113
ErrNotInitialized7
ErrNotReady3
ErrNotSupported4
ErrOk0
ErrPcmsendBufferoverflow201
ErrPcmsendFormat200
ErrRefused5
ErrResourceLimited22
ErrSetClientRoleNotAuthorized119
ErrSizeTooLarge114
ErrStreamMessageTimeout117
ErrTimedout10
ErrTokenExpired109
ErrTooManyDataStreams116
ErrVdmCameraNotAuthorized1501
IRtcEnginenull

the platform REST layer uses REST error codes;the SDK layer maps connection/authentication failures to Agora error numbers, for the mapping table see SDK error identifiers per platform。

Generated by the documentation build pipeline · 2026-10-31 01:24:02 UTC · Documentation center v1.1.0.

Content follows the public API definitions.

ni-meet is a self-hosted RTC PaaS with a LiveKit-based media plane (Apache-2.0) and an Agora-compatible API.