Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network optimized for real-time web and mobile-to-mobile applications.
AgoraRtcEngineKit
class is the entry point of the Agora SDK providing API methods for apps to easily start voice and video communication.AgoraRtcEngineDelegate
protocol to report runtime events to the app.This page provides Reference for Agora high-level APIs.
Method | Function |
---|---|
sharedEngineWithConfig | Initializes RtcEngine. |
destroy | Destroys the RtcEngine instance. |
setChannelProfile | Sets the channel profile. |
joinChannelByToken1 | Joins a channel. |
joinChannelByToken2 | Joins a channel with media options. |
leaveChannel | Allows a user to leave a channel. |
setClientRole | Sets the role of the user. |
renewToken | Renews the Token. |
getConnectionState | Gets the connection state of the app. |
Event | Description |
---|---|
didJoinChannel | Occurs when a user joins a channel. |
didRejoinChannel | Occurs when a user rejoins a channel. |
didClientRoleChanged | Occurs when the user role switches in a live broadcast. |
didLeaveChannelWithStats | Occurs when a user leaves a channel. |
didJoinedOfUid | Occurs when a remote user joins a channel. |
didOfflineOfUid | Occurs when a remote user leaves a channel. |
rtcEngineConnectionDidLost | Occurs when the connection between the SDK is interrupted, and the SDK cannot reconnect to the edge server in 10 seconds. |
rtcEngineRequestToken | Occurs when the token expires. |
tokenPrivilegeWillExpire | Occurs when the token expires in 30 seconds. |
Method | Function |
---|---|
enableAudio | Enables the audio module. |
disableAudio | Disables the audio module. |
setAudioProfile1 | Sets the audio parameters and application scenarios. |
setAudioProfile2 | Sets the audio parameters. |
adjustRecordingSignalVolume | Adjusts the recording volume. |
enableLocalAudio | Enables or disables the local audio capture. |
muteLocalAudioStream | Stops or resumes sending the local audio stream. |
muteRemoteAudioStream | Stops or resumes receiving the audio stream of a specified user. |
muteAllRemoteAudioStreams | Stops or resumes receiving all remote audio streams. |
Method | Function |
---|---|
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. |
setupLocalVideo | Initializes the local video view. |
setLocalRenderMode | Updates the display mode of the local video view. |
enableLocalVideo | Enables/Disables the local video capture. |
muteLocalVideoStream | Sends/Stops sending the local video. |
muteRemoteVideoStream | Receives/Stops receiving a specified video stream. |
muteAllRemoteVideoStreams | Receives/Stops receiving all remote video streams. |
Event | Description |
---|---|
localAudioStateChange | Occurs when the local audio state changes. |
firstLocalAudioFramePublished | Occurs when the first audio frame is published. |
localVideoStateChange | Occurs when the state of the local video changes. |
Event | Description |
---|---|
remoteAudioStateChangedOfUid | Occurs when the remote audio state changes. |
remoteVideoStateChangedOfUid | Occurs when the remote video stream state changes. |
After joining a channel, SDK triggers this group of callbacks once every two seconds.
Event | Description |
---|---|
localAudioStats | Reports the statistics of the local audio stream. |
remoteAudioStats | Reports the statistics of the audio stream from each remote user/host. |
reportRtcStats | Reports the statistics of the Rtc Engine. |
localVideoStats | Reports the statistics of the uploading local video streams. |
remoteVideoStats | Reports the statistics of the video stream from each remote user/host. |
Method | Description |
---|---|
joinChannelExByToken | Joins a channel with the connection ID. Call this method multiple times to join more than one channels at a time. |
leaveChannelEx | Leaves the channel with the specified connection ID. |
setupRemoteVideoEx | Initializes the video view of a remote user. |
setRemoteRenderModeEx | Updates the display mode of the video view of a remote user. |
Method | Function |
---|---|
enableAudioVolumeIndication | Enables the SDK to regularly report to the application on which users are speaking and the speakers' volume. |
Event | Description |
---|---|
reportAudioVolumeIndicationOfSpeakers | Reports which users are speaking and the speakers' volume at the moment. |
This group of methods is for iOS only.
Method | Function |
---|---|
setDefaultAudioRouteToSpeakerphone | Sets the default audio route. |
setEnableSpeakerphone | Enables/Disables the audio route to the speakerphone. |
isSpeakerphoneEnabled | Checks whether the speakerphone is enabled. |
Event | Description |
---|---|
didAudioRouteChanged | Occurs when the local audio route changes. |
Method | Function |
---|---|
startAudioMixing | Starts playing and mixing 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 of audio mixing. |
getAudioMixingDuration | Gets the duration (ms) of the music file. |
getAudioMixingCurrentPosition | Gets the playback position (ms) of the music file. |
setAudioMixingPosition | Sets the playback position of the music file. |
adjustAudioMixingPublishVolume | Adjusts the volume of audio mixing for publishing (sending to other users). |
getAudioMixingPublishVolume | Retrieves the audio mixing volume for publishing. |
adjustAudioMixingPlayoutVolume | Adjusts the volume of audio mixing for local playback. |
getAudioMixingPlayoutVolume | Retrieves the audio mixing volume for local playback. |
Event | Description |
---|---|
audioMixingStateChanged | Occurs when the state of the local user's audio mixing file changes. |
Method | Function |
---|---|
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. |
事件 | 功能 |
---|---|
rtcEngineDidAudioEffectFinish | Occurs when the local audio effect playback finishes. |
Method | Function |
---|---|
setLocalVoiceChanger | Sets the local voice changer option. |
setLocalVoiceReverbPreset | Sets the preset local voice reverberation effect. |
This group of methods is for iOS only.
Method | Function |
---|---|
enableInEarMonitoring | Enables in-ear monitoring. |
setInEarMonitoringVolume | Sets the volume of the in-ear monitor. |
Method | Function |
---|---|
startLastmileProbeTest | Starts the last-mile network probe test. |
stopLastmileProbeTest | Stops the last-mile network probe test. |
Event | Description |
---|---|
lastmileProbeTestResult | Reports the last-mile network probe result. |
This group of methods is for iOS only.
Method | Function |
---|---|
switchCamera | Switches between front and rear cameras. |
Method | Function |
---|---|
enableDualStreamMode | Enables/Disables the dual-stream mode. |
setRemoteDefaultVideoStreamType | Sets the default video stream type of the remote stream. |
Method | Function |
---|---|
setExternalAudioSource1 | Sets the external audio source. |
setExternalAudioSource2 | Sets the external audio source. |
pushExternalAudioFrameRawData | Pushes the external raw audio frame to the Agora SDK for encoding. |
pushExternalAudioFrameSampleBuffer | Pushes the external CMSampleBuffer audio frame to the SDK for encoding. |
Method | Function |
---|---|
setExternalVideoSource | Sets the external video source. |
pushExternalVideoFrame | Pushes the external video frame. |
This group of methods is applicable to the live interactive streaming only.
Do not implement metadataMaxSize, readyToSendMetadataAtTimestamp, andreceiveMetadata in AgoraRtcEngineDelegate.
Method | Function |
---|---|
setMediaMetadataDataSource | Sets the data source of the media metadata. |
setMediaMetadataDelegate | Sets the delegate of the metadata. |
Event | Description |
---|---|
metadataMaxSize | Occurs when the SDK requests the maximum size of the metadata. |
readyToSendMetadataAtTimestamp | Occurs when the sender is ready to send the metadata. |
receiveMetadata | Occurs when the receiver receives the metadata. |
Method | Function |
---|---|
setAudioFrameDelegate | Registers an audio frame delegate. |
setRecordingAudioFrameParametersWithSampleRate | Sets the audio recording format for the onRecordAudioFrame callback. |
setPlaybackAudioFrameParametersWithSampleRate | Sets the audio recording format for the onPlaybackAudioFrame callback. |
setMixedAudioFrameParametersWithSampleRate | Sets the audio recording format for the onMixedAudioFrame callback. |
setPlaybackAudioFrameBeforeMixingParametersWithSampleRate | Sets the audio recording format for the onPlaybackAudioFrameBeforeMixing callback. |
Method | Description |
---|---|
onRecordAudioFrame | Retrieves the local user's raw audio data. |
onPlaybackAudioFrame | Retrieves all the remote users' raw audio data. |
onMixedAudioFrame | Retrieves the raw audio data of the local user and all the remote users. |
onPlaybackAudioFrameBeforeMixing | Retrieves the raw audio data of a specific remote user. |
Method | Function |
---|---|
createDataStream | Creates a data stream. |
sendStreamMessage | Sends data stream messages. |
Event | Description |
---|---|
receiveStreamMessageFromUid | Occurs when the local user receives the data stream from a remote user within five seconds. |
didOccurStreamMessageErrorFromUid | Occurs when the local user fails to receive the data stream from the remote user within five seconds. |
Method | Function |
---|---|
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. |
getSdkVersion | Gets the Agora SDK version. |
getErrorDescription | Retrieves the description of a warning or error code. |
setLogFile | Specifies an SDK output log file. |
setLogFilter | Sets the output log filter level of the SDK. |
setLogLevel | Sets the output log level of the SDK. |
sendCustomReportMessage | Reports and analyzes customized messages. |
Event | Description |
---|---|
didApiCallExecute | Occurs when an API method is executed. |