The Agora React Native SDK wraps the Agora RTC SDKs for Android and iOS, with which you can quickly implement real-time communication functionality in Android and iOS apps developed using the React Native framework.

  • The RtcEngine class provides the main methods that can be invoked by your application.
  • The RtcEngineEvents class enables callbacks to your application.
  • The RtcChannel class provides methods that enable real-time communications in a specified channel. By creating multiple RtcChannel instances, users can join multiple channels.
  • The RtcChannelEvents class provides callbacks that report events and statistics of a specified channel.

Channel management

Method Description
create Creates an RtcEngine instance.
createWithAreaCode Creates an RtcEngine instance and specifies the connection area.
instance Gets a created RtcEngine instance.
destroy Destroys the RtcEngine instance.
setChannelProfile Sets the channel profile of the Agora RtcEngine.
setClientRole Sets the user role (LiveBroadcasting profile only).
joinChannel Allows a user to join a channel.
switchChannel Switches to a different channel (LiveBroadcasting profile only).
leaveChannel Allows a user to leave a channel.
renewToken Renews the token.
getConnectionState Gets the connection state of the app.

Channel events

Event Description
ConnectionStateChanged Occurs when the network connection state changes.
JoinChannelSuccess Occurs when a user joins a channel.
RejoinChannelSuccess Occurs when a user rejoins a channel.
LeaveChannel Occurs when a user leaves a channel.
ClientRoleChanged Occurs when the user role in a live streaming changes.
UserJoined Occurs when a remote user joins a channel.
UserOffline Occurs when a remote user leaves a channel or goes offline.
NetworkTypeChanged Occurs when the network type changes.
ConnectionLost Occurs when the SDK loses connection to the server.
TokenPrivilegeWillExpire Occurs when the token expires in 30 seconds.
RequestToken Occurs when the token expires.

Audio management

Method Description
enableAudio Enables the audio module.
disableAudio Disables the audio module.
setAudioProfile Sets the audio parameters and application scenarios.
adjustRecordingSignalVolume Adjusts the recording volume.
adjustUserPlaybackSignalVolume Adjusts the playback volume of a specified remote user.
adjustPlaybackSignalVolume Adjusts the playback volume of all remote users.
enableLocalAudio Enables/disables the local audio capture.
muteLocalAudioStream Stops/Resumes sending the local audio stream.
muteRemoteAudioStream Stops/Resumes receiving a specified remote audio stream.
muteAllRemoteAudioStreams Stops/Resumes receiving all remote audio streams.
setDefaultMuteAllRemoteAudioStreams Sets whether to receive all remote audio streams by default.

Video management

Method Description
enableVideo Enables the video module.
disableVideo Disables the video module.
setVideoEncoderConfiguration Sets the video encoder configuration.
startPreview Starts the local video preview.
stopPreview Stops the local video preview.
enableLocalVideo Enables/Disables the local video capture.
muteLocalVideoStream Stops/Resumes sending the local video stream.
muteRemoteVideoStream Stops/Resumes receiving a specified remote video stream.
muteAllRemoteVideoStreams Stops/Resumes receiving all remote video streams.
setDefaultMuteAllRemoteVideoStreams Sets whether to receive all remote video streams by default.

Local media events

Event Description
LocalAudioStateChanged Occurs when the local audio state changes.
LocalVideoStateChanged Occurs when the local video state changes.
FirstLocalVideoFrame Occurs when the first local video frame is rendered.

Remote media events

Event Description
RemoteAudioStateChanged Occurs when the remote audio state changes.
RemoteVideoStateChanged Occurs when the remote video state changes.
FirstRemoteVideoFrame Occurs when the first remote video frame is rendered.

Statistics events

After joining a channel, SDK triggers this group of callbacks once every two seconds.

Event Description
RtcStats Reports the statistics of RtcEngine.
NetworkQuality Reports the network quality of each user.
LocalAudioStats Reports the statistics of the local audio stream.
LocalVideoStats Reports the statistics of the uploading local video stream.
RemoteAudioStats Reports the statistics of the audio stream from each remote user/host.
RemoteVideoStats Reports the statistics of the video stream from each remote user/host.

Video pre-process and post-process

Method Description
setBeautyEffectOptions Sets the image enhancement options.

Multi-channel management

Method Description
create Initializes and gets an RtcChannel instance. To join multiple channels, create multiple RtcChannel objects.
RtcChannel Provides methods that enable real-time communications in a specified channel.
RtcChannelEvents Provides callbacks that report events and statistics in a specified channel.

Audio file playback and mixing

Method Description
startAudioMixing Starts playing and mixing the music file.
stopAudioMixing Stops playing or mixing the music file.
pauseAudioMixing Pauses playing and mixing the music file.
resumeAudioMixing Resumes playing and mixing the music file.
adjustAudioMixingVolume Adjusts the volume of audio mixing.
adjustAudioMixingPlayoutVolume Adjusts the volume of audio mixing for local playback.
adjustAudioMixingPublishVolume Adjusts the volume of audio mixing for remote playback.
setAudioMixingPitch Sets the pitch of the local music file.
getAudioMixingPlayoutVolume Gets the volume of audio mixing for local playback.
getAudioMixingPublishVolume Gets the volume of audio mixing for remote playback.
getAudioMixingDuration Gets the duration (ms) of the music file.
getAudioMixingCurrentPosition Gets the playback position (ms) of the music file.
setAudioMixingPosition Sets the playback starting position (ms) of the music file.
Event Description
AudioMixingStateChanged Occurs when the state of the local user's audio mixing file changes.

Audio effect playback

Method Description
getEffectsVolume Gets the volume of the audio effects.
setEffectsVolume Sets the volume of the audio effects.
setVolumeOfEffect Sets the volume of a specified audio effect.
playEffect Plays a specified audio effect.
stopEffect Stops playing a specified audio effect.
stopAllEffects Stops playing all audio effects.
preloadEffect Preloads a specified audio effect file into the memory.
unloadEffect Releases a specified preloaded audio effect from the memory.
pauseEffect Pauses a specified audio effect.
pauseAllEffects Pauses all audio effects.
resumeEffect Resumes playing a specified audio effect.
resumeAllEffects Resumes playing all audio effects.
Event Description
AudioEffectFinished Occurs when the audio effect file playback finishes.

Voice changer and reverberation

Method Description
setLocalVoiceChanger Sets the local voice changer option.
setLocalVoiceReverbPreset Sets the preset local voice reverberation effect.
setLocalVoicePitch Sets the voice pitch of the local speaker.
setLocalVoiceEqualization Sets the local voice equalization effect.
setLocalVoiceReverb Sets the local voice reverberation.

Sound position indication

Method Description
enableSoundPositionIndication Enables/Disables stereo panning for remote users.
setRemoteVoicePosition Sets the sound position and gain of a remote user.

CDN publisher

This group of methods apply to LiveBroadcasting profile only.

Method Description
setLiveTranscoding Sets the video layout and audio settings for CDN live.
addPublishStreamUrl Publishes the local stream to the CDN.
removePublishStreamUrl Removes an RTMP stream from the CDN.
Event Description
RtmpStreamingStateChanged Occurs when the state of the RTMP streaming changes.
TranscodingUpdated Occurs when the publisher's transcoding settings are updated.

Channel Media Relay

Method Description
startChannelMediaRelay Starts to relay media streams across channels.
updateChannelMediaRelay Updates the channels for media stream relay.
stopChannelMediaRelay Stops the media stream relay.
Event Description
ChannelMediaRelayStateChanged Occurs when the state of the media stream relay changes.
ChannelMediaRelayEvent Reports events during the media stream relay.

Audio volume indication

Method Description
enableAudioVolumeIndication Enables the AudioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.
Event Description
AudioVolumeIndication Reports which users are speaking and the speakers' volume, and whether the local user is speaking.
ActiveSpeaker Reports which user is the loudest speaker.

Face detection

Method Description
enableFaceDetection Enables/Disables face detection for the local user.
Event Description
FacePositionChanged Reports the face detection result of the local user.

Audio routing control

Method Description
setDefaultAudioRoutetoSpeakerphone Sets the default audio playback route.
setEnableSpeakerphone Enables/Disables the audio playback route to the speakerphone.
isSpeakerphoneEnabled Checks whether the speakerphone is enabled.
Event Description
AudioRouteChanged Occurs when the local audio playback route changes.

In-ear monitoring

Method Description
enableInEarMonitoring Enables in-ear monitoring.
setInEarMonitoringVolume Sets the volume of the in-ear monitor.

Dual video stream mode

Method Description
enableDualStreamMode Enables/disables dual video stream mode.
setRemoteVideoStreamType Sets the video stream type of the remotely subscribed video stream.
setRemoteDefaultVideoStreamType Sets the default video stream type of the remotely subscribed video stream.

Stream fallback

Method Description
setLocalPublishFallbackOption Sets the fallback option for the locally published video stream under unreliable network conditions.
setRemoteSubscribeFallbackOption Sets the fallback option for the remotely subscribed video stream under unreliable network conditions.
setRemoteUserPriority Sets the priority of a remote user's stream.
Event Description
LocalPublishFallbackToAudioOnly Occurs when the locally published video stream falls back to audio only due to poor network conditions or switches back to the video stream after the network conditions improve.
RemoteSubscribeFallbackToAudioOnly Occurs when the remotely subscribed video stream falls back to audio ly due to poor network conditions or switches back to the video stream after the network conditions improve.

Pre-call network test

Method Description
startEchoTest Starts an audio call test.
stopEchoTest Stops the audio call test.
enableLastmileTest Enables the network connection quality test.
disableLastmileTest Disables the network connection quality test.
startLastmileProbeTest Starts the last-mile probe test.
stopLastmileProbeTest Stops the last-mile probe test.
Event Description
LastmileQuality Reports the last-mile network quality of the local user before the user joins a channel.
LastmileProbeResult Reports the last-mile network probe result.

Media metadata

This group of methods apply to LiveBroadcasting profile only.

Method Description
registerMediaMetadataObserver Registers a media metadata observer object.
setMaxMetadataSize Sets the maximum size of the metadata.
sendMetadata Sends the metadata.
unregisterMediaMetadataObserver Unregisters the metadata observer.

Watermark

This group of methods apply to LiveBroadcasting profile only.

Method Description
addVideoWatermark Adds a watermark image to the local video.
clearVideoWatermarks Removes the added watermark image from the video stream.

Encryption

Method Description
setEncryptionSecret Enables built-in encryption with an encryption password before joining a channel.
setEncryptionMode Sets the built-in encryption mode.

Audio recorder

Method Description
startAudioRecording Starts an audio recording on the client.
stopAudioRecording Stops the audio recording on the client.

Inject an online media stream

This group of methods apply to LiveBroadcasting profile only.

Method Description
addInjectStreamUrl Injects an online media stream to a live streaming.
removeInjectStreamUrl Removes the injected online media stream from a live streaming.
Event Description
StreamInjectedStatus Reports the status of injecting the online media stream.

Camera control

Method Description
switchCamera Switches between front and rear cameras.
isCameraZoomSupported Checks whether the camera zoom function is supported.
isCameraTorchSupported Checks whether the camera flash function is supported.
isCameraFocusSupported Checks whether the camera manual focus function is supported.
isCameraExposurePositionSupported Checks whether the camera exposure function is supported.
isCameraAutoFocusFaceModeSupported Checks whether the camera face auto-focus function is supported.
setCameraZoomFactor Sets the camera zoom ratio.
getCameraMaxZoomFactor Gets the maximum zoom ratio of the camera.
setCameraFocusPositionInPreview Sets the camera manual focus position.
setCameraExposurePosition Sets the camera exposure position.
setCameraTorchOn Enables the camera flash function.
setCameraAutoFocusFaceModeEnabled Enables the camera auto-face focus function.
Event Description
CameraFocusAreaChanged Occurs when the camera focus area changes.
CameraExposureAreaChanged Occurs when the camera exposure area changes.

Stream message

Method Description
createDataStream Creates a data stream.
sendStreamMessage Sends data stream messages.
Event Description
StreamMessage Occurs when the local user receives a remote data stream within five seconds.
StreamMessageError Occurs when the local user fails to receive the remote data stream.

Miscellaneous video control

Method Description
setCameraCapturerConfiguration Sets the camera capturer configuration.

Miscellaneous methods

Method Description
getCallId Gets the current call ID.
rate Allows a user to rate a call after the call ends.
complain Allows a user to complain about the call quality after a call ends.
setLogFile Specifies an SDK output log file.
setLogFilter Sets the output log level of the SDK.
setLogFileSize Sets the log file size.
addListener Adds the RtcEngineEvents class.
removeListener Removes the specified RtcEngineEvents object.
removeAllListeners Removes all the RtcEngineEvents objects.

Miscellaneous events

Event Description
Warning Occurs when a warning occurs.
Error Occurs when an error occurs.
ApiCallExecuted Occurs when an API method is executed.