API Overview
Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through SD-RTN™.
Channel management
Method | Description |
---|---|
sharedEngineWithAppId | Creates and initializes AgoraRtcEngineKit. |
sharedEngineWithConfig | Creates and initializes AgoraRtcEngineKit. |
destroy | Releases the AgoraRtcEngineKit instance. |
setChannelProfile | Sets the channel profile. |
joinChannelByToken [1/2] | Joins a channel. |
joinChannelByToken [2/2] | Joins a channel with media options. |
updateChannelWithMediaOptions | Updates the channel media options after joining the channel. |
leaveChannel [1/2] | Leaves a channel. |
leaveChannel [2/2] | Leaves a channel. |
renewToken | Gets a new token when the current token expires after a period of time. |
setClientRole [1/2] | Sets the client role. |
setClientRole [2/2] | Sets the user role and level in an interactive live streaming channel. |
getConnectionState | Gets the current connection state of the SDK. |
Channel events
Event | Description |
---|---|
didJoinChannel | Occurs when a user joins a channel. |
didRejoinChannel | Occurs when a user rejoins the channel. |
didClientRoleChanged | Occurs when the user role switches in the interactive live streaming. |
didLeaveChannelWithStats | Occurs when a user leaves a channel. |
didJoinedOfUid | Occurs when a remote user (COMMUNICATION)/ host (LIVE_BROADCASTING) joins the channel. |
didOfflineOfUid | Occurs when a remote user (COMMUNICATION)/ host (LIVE_BROADCASTING) leaves the channel. |
didAudioMuted | Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) joins the channel. |
networkTypeChangedToType | Occurs when the local network type changes. |
uplinkNetworkInfoUpdate | Occurs when the uplink network information changes. |
rtcEngineConnectionDidLost | Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after its connection to the server is interrupted. |
connectionChangedToState | Occurs when the network connection state changes. |
rtcEngineRequestToken | Occurs when the token expires. |
tokenPrivilegeWillExpire | Occurs when the token expires in 30 seconds. |
Audio management
Method | Description |
---|---|
enableAudio | Enables the audio module. |
disableAudio | Disables the audio module. |
setAudioProfile [1/2] | Sets the audio profile and audio scenario. |
setAudioProfile [2/2] | Sets the audio parameters and application 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. |
adjustLoopbackRecordingVolume | Adjusts the volume of the signal captured by the sound card. |
muteRecordingSignal | Whether to mute the recording signal. |
enableLocalAudio | Enables/Disables the local audio capture. |
muteLocalAudioStream | Stops or resumes publishing the local audio stream. |
muteRemoteAudioStream | Stops or resumes subscribing to the audio stream of a specified user. |
muteAllRemoteAudioStreams | Stops or resumes subscribing to the audio streams of all remote users. |
setDefaultMuteAllRemoteAudioStreams | Stops or resumes subscribing to the audio streams of all remote users by default. |
Video management
Method | Description |
---|---|
enableVideo | Enables the video module. |
disableVideo | Disables the video module. |
setVideoEncoderConfiguration | Sets the video encoder configuration. |
startPreview | Enables the local video preview. |
stopPreview | Stops the local video preview. |
setupLocalVideo | Initializes the local video view. |
setupRemoteVideo | Initializes the video view of a remote user. |
setLocalRenderMode [2/2] | Updates the display mode of the local video view. |
setRemoteRenderMode [2/2] | Updates the display mode of the video view of a remote user. |
enableLocalVideo | Enables/Disables the local video capture. |
muteLocalVideoStream | Stops or resumes publishing the local video stream. |
muteRemoteVideoStream | Stops or resumes subscribing to the video stream of a specified user. |
muteAllRemoteVideoStreams | Stops or resumes subscribing to the video streams of all remote users. |
setDefaultMuteAllRemoteVideoStreams | Stops or resumes subscribing to the video streams of all remote users by default. |
Capture screenshots
Method | Description |
---|---|
takeSnapshot | Takes a snapshot of a video stream. |
Event | Description |
---|---|
snapshotTaken | Reports the result of taking a video snapshot. |
Media player
Method | Description |
---|---|
createMediaPlayerWithDelegate | Creates a media player instance. |
AgoraRtcMediaPlayerProtocol | This class provides media player functions and supports multiple instances. |
AgoraRtcMediaPlayerDelegate | Provides callbacks for media players. |
Local media events
Event | Description |
---|---|
localAudioStateChanged | Occurs when the local audio stream state changes. |
localVideoStateChangedOfState | Occurs when the local video stream state changes. |
firstLocalAudioFramePublished | Occurs when the first audio frame is published. |
firstLocalVideoFramePublishedWithElapsed | Occurs when the first video frame is published. |
didAudioPublishStateChange | Occurs when the audio publishing state changes. |
didVideoPublishStateChange | Occurs when the video publishing state changes. |
Remote media events
Event | Description |
---|---|
remoteAudioStateChangedOfUid | Occurs when the remote audio state changes. |
remoteVideoStateChangedOfUid | Occurs when the remote video state changes. |
didAudioSubscribeStateChange | Occurs when the audio subscribing state changes. |
didVideoSubscribeStateChange | Occurs when the video subscribing state changes. |
Statistics events
Event | Description |
---|---|
reportRtcStats | Reports the statistics of the current call. |
networkQuality | Reports the last mile network quality of each user in the channel. |
localAudioStats | Reports the statistics of the local audio stream. |
localVideoStats | Reports the statistics of the local video stream. |
remoteAudioStats | Reports the transport-layer statistics of each remote audio stream. |
remoteVideoStats | Reports the transport-layer statistics of each remote video stream. |
Video pre-process and post-process
Method | Description |
---|---|
setBeautyEffectOptions | Sets the image enhancement options. |
enableVirtualBackground | Enables/Disables the virtual background. (beta feature) |
Music file playback and mixing
Method | Description |
---|---|
startAudioMixing [2/2] | Starts playing the music file. |
stopAudioMixing | Stops playing and mixing the music file. |
pauseAudioMixing | Pauses playing and mixing 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. |
Event | Description |
---|---|
audioMixingStateChanged | 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 [3/3] | Plays the specified local or online audio effect file. |
pauseEffect | Pauses a specified audio effect. |
pauseAllEffects | Pauses all audio effects. |
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. |
Voice changer and reverberation
Method | Description |
---|---|
setLocalVoiceEqualizationOfBandFrequency | Sets the local voice equalization effect. |
setLocalVoicePitch | Changes the voice pitch of the local speaker. |
setLocalVoiceReverbOfType | 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 |
---|---|
startEchoTestWithInterval | 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 |
---|---|
lastmileQuality | Reports the last-mile network quality of the local user once every two seconds. |
lastmileProbeTestResult | Reports the last mile network probe result. |
Screen sharing
Method | Description |
---|---|
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) |
stopScreenCapture | Stops screen sharing. (For Android, Windows and macOS only) |
updateScreenCaptureRegion | Updates the screen sharing region. |
updateScreenCaptureParameters | Updates the screen sharing parameters. |
Video dual stream
Method | Description |
---|---|
enableDualStreamMode [1/3] | Enables/Disables dual-stream mode. |
enableDualStreamMode [2/3] | Enables/Disables dual-stream mode. |
enableDualStreamMode [3/3] | Enables/Disables dual-stream mode. |
setRemoteVideoStream | Sets the stream type of the remote video. |
setRemoteDefaultVideoStreamType | Sets the default stream type of remote video streams. |
Watermark
Method | Description |
---|---|
addVideoWatermark [2/2] | 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 |
---|---|
didOccurEncryptionError | 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. |
Media push
Method | Description |
---|---|
setLiveTranscoding | Sets the transcoding configurations for media push. |
addPublishStreamUrl | Publishes the local stream to a specified CDN live streaming URL. |
removePublishStreamUrl | Removes an RTMP or RTMPS stream from the CDN. |
Event | Description |
---|---|
rtmpStreamingChangedToState | Occurs when the media push state changes. |
rtcEngineTranscodingUpdated | Occurs when the publisher's transcoding is updated. |
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 |
---|---|
channelMediaRelayStateDidChange | Occurs when the state of the media stream relay changes. |
didReceiveChannelMediaRelayEvent | Reports events during the media stream relay. |
Custom audio source
Method | Description |
---|---|
setExternalAudioSource [2/2] | Sets the external audio source parameters. |
pushExternalAudioFrameSampleBuffer | Pushes the external CMSampleBuffer audio frame to the SDK. |
pushExternalAudioFrameNSData | Pushes the external audio frame to the SDK. |
Raw audio data
Method | Description |
---|---|
setRecordingAudioFrameParametersWithSampleRate | Sets the format of the captured raw audio data. |
setPlaybackAudioFrameParametersWithSampleRate | Sets the audio data format for playback. |
setMixedAudioFrameParametersWithSampleRate | Sets the audio data format reported by onMixedAudioFrame. |
setPlaybackAudioFrameBeforeMixingParametersWithSampleRate | Sets the audio data format reported by onPlaybackAudioFrameBeforeMixing. |
Event | Description |
---|---|
onRecordAudioFrame | Gets the captured audio frame. |
onPlaybackAudioFrame | Gtes the audio frame for playback. |
onPlaybackAudioFrameBeforeMixing | Retrieves the audio frame of a specified user before mixing. |
onMixedAudioFrame | Retrieves the mixed captured and playback audio frame. |
Encoded audio data
Method | Description |
---|---|
registerAudioEncodedFrameObserver | Registers an encoded audio observer. |
Event | Description |
---|---|
onRecordEncodedAudioFrame | Gets the encoded audio data of the local user. |
onPlaybackEncodedAudioFrame | Gets the encoded audio data of all remote users. |
onMixedEncodedAudioFrame | Gets the mixed and encoded audio data of the local and all remote users. |
Audio spectrum
Method | Description |
---|---|
registerAudioSpectrumDelegate | Register an audio spectrum observer. |
enableAudioSpectrumMonitor | Turn on audio spectrum monitoring. |
disableAudioSpectrumMonitor | Disables audio spectrum monitoring. |
unregisterAudioSpectrumDelegate | Unregisters the audio spectrum observer. |
Event | Description |
---|---|
onLocalAudioSpectrum | Gets the statistics of a local audio spectrum. |
onRemoteAudioSpectrum | Gets the remote audio spectrum. |
External video source
Method | Description |
---|---|
setExternalVideoSource | Configures the external video source. |
pushExternalVideoFrame | Pushes the external raw video frame to the SDK. |
Raw video data
Method | Description |
---|---|
setVideoFrameDelegate | 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. |
onPreEncodeScreenVideoFrame | Gets the video data captured from the screen before encoding. |
onScreenCaptureVideoFrame | Occurs each time the SDK receives a video frame captured by the screen. |
onRenderVideoFrame | Occurs each time the SDK receives a video frame sent by the remote user. |
onMediaPlayerVideoFrame | Gets the video data of the media player. |
getObservedFramePosition | Sets the frame position for the video observer. |
getVideoFrameProcessMode | Occurs each time the SDK receives a video frame and prompts you to set the process mode of the video frame. |
getMirrorApplied | Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video. |
getRotationApplied | Occurs each time the SDK receives a video frame, and prompts you whether to rotate the captured video. |
Extension
Method | Description |
---|---|
enableExtensionWithVendor | Enables/Disables extensions. |
setExtensionPropertyWithVendor | Sets the properties of the extension. |
setExtensionProviderPropertyWithVendor | Sets the properties of the extension provider. |
Event | Description |
---|---|
onEvent | The event callback of the extension. |
onExtensionStarted | Occurs when the extension is enabled. |
onExtensionStopped | Occurs when the extension is disabled. |
onExtensionError | Occurs when the extension runs incorrectly. |
Media metadata
Method | Description |
---|---|
setMediaMetadataDelegate | Registers the metadata observer. |
setMediaMetadataDataSource | Sets the data source of the metadata. |
Event | Description |
---|---|
metadataMaxSize | Occurs when the SDK requests the maximum size of the metadata. |
readyToSendMetadataAtTimestamp | Occurs when the SDK is ready to send metadata. |
receiveMetadata | Occurs when the local user receives the metadata. |
Audio recording
Method | Description |
---|---|
startAudioRecording [2/2] | Starts audio recording on the client. |
stopAudioRecording | Stops the audio recording on the client. |
Multiple channels
Method | Description |
---|---|
joinChannelExByToken | 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 |
---|---|
reportAudioVolumeIndicationOfSpeakers | Reports the volume information of users. |
activeSpeaker | Occurs when the most active speaker is detected. |
Data stream
Method | Description |
---|---|
createDataStream [2/2] | Creates a data stream. |
sendStreamMessage | Sends data stream messages. |
Event | Description |
---|---|
receiveStreamMessageFromUid | Occurs when the local user receives the data stream from the remote user. |
didOccurStreamMessageErrorFromUid | Occurs when the local user does not receive the data stream from the remote user. |
Device management
Method | Description |
---|---|
enumerateDevices | Enumerates all the audio and video devices in the system. |
getDeviceInfo | Retrieves the name of the current device. |
getDeviceVolume | Retrieves the volume of the current device. |
monitorDeviceChange | Monitors the change of the device state. |
setDevice | Specifies a device with the device ID. |
setDeviceVolume | Sets the volume of the specified device. |
startAudioDeviceLoopbackTest | Starts an audio device loopback test. |
startPlaybackDeviceTest | Starts the audio playback device test. |
startRecordingDeviceTest | Starts the audio capture device test. |
stopAudioDeviceLoopbackTest | Stops the audio device loopback test. |
stopPlaybackDeviceTest | Stops the audio playback device test. |
stopRecordingDeviceTest | Stops the audio capture device test. |
Event | Description |
---|---|
stateChanged | Occurs when the device state changes. |
Miscellaneous audio control
Method | Description |
---|---|
enableLoopbackRecording | Enables loopback audio capturing. |
Miscellaneous methods
Method | Description |
---|---|
setCloudProxy | Sets the Agora cloud proxy service. |
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. |
getSdkVersion | Gets the SDK version. |
Miscellaneous events
Event | Description |
---|---|
didApiCallExecute | Occurs when a method is executed by the SDK. |