API Overview

Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through SD-RTN™.

Channel management

Method Description
initialize Initializes IRtcEngine.
release Releases the IRtcEngine instance.
setChannelProfile Sets the channel profile.
joinChannel [2/2] Joins a channel with media options.
updateChannelMediaOptions Updates the channel media options after joining the channel.
leaveChannel Leaves a channel.
renewToken Gets a new token when the current token expires after a period of time.
getConnectionState Gets the current connection state of the SDK.

Channel events

Event Description
onJoinChannelSuccess Occurs when a user joins a channel.
onRejoinChannelSuccess Occurs when a user rejoins the channel.
onClientRoleChanged Occurs when the user role switches in the interactive live streaming.
onClientRoleChangeFailed Occurs when the user role switch fails in the interactive live streaming.
onLeaveChannel Occurs when a user leaves a channel.
onUserJoined Occurs when a remote user (COMMUNICATION)/ host (LIVE_BROADCASTING) joins the channel.
onUserOffline Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) leaves the channel.
onNetworkTypeChanged Occurs when the local network type changes.
onUplinkNetworkInfoUpdated Occurs when the uplink network information changes.
onConnectionLost Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after its connection to the server is interrupted.
onConnectionStateChanged Occurs when the network connection state changes.
onRequestToken Occurs when the token expires.
onTokenPrivilegeWillExpire Occurs when the token expires in 30 seconds.

Audio management

Method Description
enableAudio Enables the audio module.
disableAudio Disables the audio module.
setAudioProfile Sets the audio profile and audio scenario.
setAudioScenario Sets audio scenarios.
adjustRecordingSignalVolume Adjusts the capturing signal volume.
adjustUserPlaybackSignalVolume Adjusts the playback signal volume of a specified remote user.
adjustPlaybackSignalVolume Adjusts the playback signal volume of all remote users.
adjustCustomAudioPublishVolume Adjusts the volume of the custom external audio source when it is published in the channel.
enableLocalAudio Enables/Disables the local audio capture.

Video management

Method Description
enableVideo Enables the video module.
disableVideo Disables the video module.
setRenderMode Sets the render mode of the media player.
setView Sets the view.
setVideoEncoderConfiguration Sets the video encoder configuration.
setupLocalVideo Initializes the local video view.
setupRemoteVideo Initializes the video view of a remote user.
enableLocalVideo Enables/Disables the local video capture.
muteLocalVideoStream Stops or resumes publishing the local video stream.
muteRemoteVideoStream Cancels or resumes subscribing to the specified remote user's video stream.
muteAllRemoteVideoStreams Stops or resumes subscribing to the video streams of all remote users.

Capture screenshots

Method Description
takeSnapshot Takes a snapshot of a video stream.

Video content moderation

Method Description
enableContentInspect Enables/Disables video content moderation.
Event Description
onContentInspectResult Reports the result of video content moderation.

Subscribing to and publishing audio and video streams

Method Description
setSubscribeAudioBlacklist Set the blocklist of subscriptions for audio streams.
setSubscribeAudioWhitelist Sets the allowlist of subscriptions for audio streams.
setSubscribeVideoBlacklist Set the bocklist of subscriptions for video streams.
setSubscribeVideoWhitelist Set the allowlist of subscriptions for video streams.
muteLocalAudioStream Stops or resumes publishing the local audio stream.
muteRemoteAudioStream Cancels or resumes subscribing to the specified remote user's audio stream.
muteAllRemoteAudioStreams Stops or resumes subscribing to the audio streams of all remote users.
enableLocalVideo Enables/Disables the local video capture.
muteLocalVideoStream Stops or resumes publishing the local video stream.
muteRemoteVideoStream Cancels or resumes subscribing to the specified remote user's video stream.
muteAllRemoteVideoStreams Stops or resumes subscribing to the video streams of all remote users.

Media player

Method Description
createMediaPlayer
IMediaPlayer This class provides media player functions and supports multiple instances.
IMediaPlayerCacheManager This class provides methods to manage cached media files.
IMediaPlayerSourceObserver Provides callbacks for media players.

Local media events

Event Description
onLocalAudioStateChanged Occurs when the local audio stream state changes.
onLocalVideoStateChanged Occurs when the local video stream state changes.
onFirstLocalAudioFramePublished Occurs when the first audio frame is published.
onFirstLocalVideoFramePublished Occurs when the first video frame is published.
onAudioPublishStateChanged Occurs when the audio publishing state changes.
onVideoPublishStateChanged Occurs when the video publishing state changes.

Remote media events

Event Description
onRemoteAudioStateChanged Occurs when the remote audio state changes.
onRemoteVideoStateChanged Occurs when the remote video stream state changes.
onFirstRemoteVideoFrame Occurs when the renderer receives the first frame of the remote video.
onFirstRemoteVideoDecoded Occurs when the first remote video frame is received and decoded.
onAudioSubscribeStateChanged Occurs when the audio subscribing state changes.
onVideoSubscribeStateChanged Occurs when the video subscribing state changes.
onUserMuteAudio Occurs when a remote user (in the communication profile) or a host (in the live streaming profile) stops/resumes sending the audio stream.
onUserMuteVideo Occurs when a remote user stops/resumes publishing the video stream.
onUserEnableVideo Occurs when a remote user enables/disables the video module.
onUserEnableLocalVideo Occurs when a specific remote user enables/disables the local video capturing function.

Statistics events

Event Description
onRtcStats Reports the statistics of the current call.
onNetworkQuality Reports the last mile network quality of each user in the channel.
onLocalAudioStats Reports the statistics of the local audio stream.
onLocalVideoStats Reports the statistics of the local video stream.
onRemoteAudioStats Reports the statistics of the audio stream sent by each remote users.
onRemoteVideoStats Reports the statistics of the video stream sent by each remote users.

Video pre-process and post-process

Method Description
setBeautyEffectOptions Sets the image enhancement options.
enableVirtualBackground Enables/Disables the virtual background.

In-ear monitoring

Attention:

This method is for Android and iOS only.

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

Music file playback and mixing

Method Description
stopAudioMixing Stops playing and mixing the music file.
pauseAudioMixing Pauses playing the music file.
resumeAudioMixing Resumes playing and mixing the music file.
adjustAudioMixingVolume Adjusts the volume during audio mixing.
adjustAudioMixingPlayoutVolume Adjusts the volume of audio mixing for local playback.
adjustAudioMixingPublishVolume Adjusts the volume of audio mixing for publishing.
getAudioMixingPlayoutVolume Retrieves the audio mixing volume for local playback.
getAudioMixingPublishVolume Retrieves the audio mixing volume for publishing.
getAudioMixingDuration Retrieves the duration (ms) of the music file.
getAudioMixingCurrentPosition Retrieves the playback position (ms) of the music file.
setAudioMixingPitch Sets the pitch of the local music file.
setAudioMixingPosition Sets the audio mixing position.
setAudioMixingDualMonoMode Sets the channel mode of the current audio file.
Event Description
onAudioMixingStateChanged Occurs when the playback state of the music file changes.

Audio effect file playback

Method Description
getEffectsVolume Retrieves the volume of the audio effects.
setEffectsVolume Sets the volume of the audio effects.
getVolumeOfEffect Gets the volume of a specified audio effect.
setVolumeOfEffect Sets the volume of a specified audio effect.
preloadEffect Preloads a specified audio effect file into the memory.
playEffect Plays the specified local or online sound effect file.
pauseEffect Pauses playing a specified audio effect file.
pauseAllEffects Pauses playing all audio effect files.
resumeEffect Resumes playing a specified audio effect.
resumeAllEffects Resumes playing all audio effects.
stopEffect Stops playing a specified audio effect.
stopAllEffects Stops playing all audio effects.
unloadEffect Releases a specified preloaded audio effect from the memory.
getEffectDuration Retrieves the duration of the audio effect file.
getEffectCurrentPosition Retrieves the playback position of the audio effect file.
setEffectPosition Sets the playback position of an audio effect file.

Voice changer and reverberation

Method Description
setLocalVoiceEqualization Sets the local voice equalization effect.
setLocalVoicePitch Changes the voice pitch of the local speaker.
setLocalVoiceReverb Sets the local voice reverberation.
setVoiceBeautifierPreset Sets a preset voice beautifier effect.
setVoiceBeautifierParameters Sets parameters for the preset voice beautifier effects.
setAudioEffectPreset Sets an SDK preset audio effect.
setAudioEffectParameters Sets parameters for SDK preset audio effects.
setVoiceConversionPreset Sets a preset voice beautifier effect.

Pre-call network test

Method Description
startEchoTest Starts an audio call test.
stopEchoTest Stops the audio call test.
startLastmileProbeTest Starts the last mile network probe test.
stopLastmileProbeTest Stops the last mile network probe test.
Event Description
onLastmileQuality Reports the last-mile network quality of the local user.
onLastmileProbeResult Reports the last mile network probe result.

Screen share API

Method Description
getScreenCaptureSources Gets a list of shareable screens and windows. (For Windows and macOS only)
startScreenCaptureByWindowId Shares the whole or part of a window by specifying the window ID. (For Windows and macOS only)
startScreenCaptureByDisplayId Shares the screen by specifying the display ID. (For Windows and macOS only)
setScreenCaptureContentHint Sets the content hint for screen sharing. (For Windows and macOS only)
updateScreenCaptureRegion Updates the screen sharing region. (For Windows and macOS only)
updateScreenCaptureParameters Updates the screen sharing parameters. (For Windows and macOS only)
stopScreenCapture Stops screen sharing.
setScreenCaptureScenario Sets the screen sharing scenario. (For Windows and macOS only)

Video dual stream

Method Description
enableDualStreamMode Enables/Disables dual-stream mode.
setRemoteVideoStreamType Sets the stream type of the remote video.
setRemoteDefaultVideoStreamType Sets the default stream type of subscrption for remote video streams.

Watermark

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

Encryption

Method Description
enableEncryption Enables/Disables the built-in encryption.
Event Description
onEncryptionError Reports the built-in encryption errors.

Sound localization

Method Description
enableSoundPositionIndication Enables/Disables stereo panning for remote users.
setRemoteVoicePosition Sets the 2D position (the position on the horizontal plane) of the remote user's voice.

Channel media stream relay

Method Description
startChannelMediaRelay Starts relaying media streams across channels. This method can be used to implement scenarios such as co-host across channels.
updateChannelMediaRelay Updates the channels for media stream relay.
stopChannelMediaRelay Stops the media stream relay. Once the relay stops, the host quits all the destination channels.
pauseAllChannelMediaRelay Pauses the media stream relay to all destination channels.
resumeAllChannelMediaRelay Resumes the media stream relay to all destination channels.
Event Description
onChannelMediaRelayStateChanged Occurs when the state of the media stream relay changes.
onChannelMediaRelayEvent Reports events during the media stream relay.

Encoded audio data

Method Description
registerAudioEncodedFrameObserver Registers an encoded audio observer.
Event Description
onRecordAudioEncodedFrame Gets the encoded audio data of the local user.
onPlaybackAudioEncodedFrame Gets the encoded audio data of all remote users.
onMixedAudioEncodedFrame Gets the mixed and encoded audio data of the local and all remote users.

Custom video source

Method Description
createCustomVideoTrack Creates a customized video track.
destroyCustomVideoTrack Destroys the specified video track.

External video source

Method Description
setExternalVideoSource Configures the external video source.
pushVideoFrame Pushes the external raw video frame to the SDK.

Raw video data

Method Description
registerVideoFrameObserver Registers a video frame observer object.
Event Description
onCaptureVideoFrame Occurs each time the SDK receives a video frame captured by the local camera.
onPreEncodeVideoFrame Occurs each time the SDK receives a video frame before encoding.
onRenderVideoFrame Occurs each time the SDK receives a video frame sent by the remote user.

Encoded video data

Method Description
registerVideoEncodedFrameObserver Registers a receiver object for the encoded video image.

Extension

Method Description
enableExtension Enables/Disables extensions.
setExtensionProperty Sets the properties of the extension.
setExtensionProviderProperty Sets the properties of the extension provider.
getExtensionProperty Gets detailed information of the extension.
Event Description
onExtensionEvent The event callback of the extension.
onExtensionStarted Occurs when the extension is enabled.
onExtensionStopped Occurs when the extension is disabled.

Audio recording

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

Local audio and video recording

Method Description
setMediaRecorderObserver Registers one IMediaRecorderObserver object.
startRecording Starts recording the local audio and video.
stopRecording Stops recording the local audio and video.
release Release the IMediaRecorder object.
Event Description
onRecorderStateChanged Occurs when the recording state changes.
onRecorderInfoUpdated onRecorderInfoUpdated

Multiple channels

Method Description
joinChannelEx Joins a channel with the connection ID.
leaveChannelEx Leaves a channel.

Volume indication

Method Description
enableAudioVolumeIndication Enables the reporting of users' volume indication.
Event Description
onAudioVolumeIndication Reports the volume information of users.
onActiveSpeaker Occurs when the most active remote speaker is detected.

Data stream

Method Description
createDataStream Creates a data stream.
sendStreamMessage Sends data stream messages.
Event Description
onStreamMessage Occurs when the local user receives the data stream from the remote user.
onStreamMessageError Occurs when the local user does not receive the data stream from the remote user.

Miscellaneous methods

Method Description
sendCustomReportMessageEx Agora supports reporting and analyzing customized messages.
getCallId Retrieves the 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.
getVersion Gets the SDK version.
unregisterEventHandler Removes the specified IRtcEngineEventHandler instance.
enableVideoImageSource Sets whether to replace the current video feeds with images when publishing video streams.

Miscellaneous events

Event Description
onApiCallExecuted Occurs when a method is executed by the SDK.