Agora RTC Objective-C API Reference  Refactor
Agora RTC Objective-C API Reference Documentation

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.

  • The AgoraRtcEngineKit class is the entry point of the Agora SDK providing API methods for apps to easily start voice and video communication.
  • The Agora SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the app.

This page provides Reference for Agora high-level APIs.

Channel management

Method Function
sharedEngineWithAppId Initializes RtcEngine.
destroy Destroys the RtcEngine instance.
setChannelProfile Sets the channel profile.
setClientRole Sets the role of the user.
joinChannelByToken1 Joins a channel.
joinChannelByToken2 Joins a channel with media options.
leaveChannel Allows a user to leave a channel.
renewToken Renews the Token.
getConnectionState Gets the connection state of the app.

Channel events

Event Description
didJoinChannel Occurs when a user joins a channel.
didRejoinChannel Occurs when a user rejoins a channel.
didLeaveChannelWithStats Occurs when a user leaves a channel.
didClientRoleChanged Occurs when the user role switches in a live broadcast.
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.
tokenPrivilegeWillExpire Occurs when the token expires in 30 seconds.
rtcEngineRequestToken Occurs when the token expires.

Audio management

Method Function
enableAudio Enables the audio module.
disableAudio Disables the audio module.
setAudioProfile Sets the audio parameters and application scenarios.
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.

Video management

Method Function
enableVideo Enables the video module.
disableVideo Disables the video module.
setupLocalVideo Initializes the local video view.
setLocalRenderMode Updates the display mode of the local video view.
startPreview Starts the local video preview.
stopPreview Stops the local video preview.
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.

Local media events

Event Description
localAudioStateChange Occurs when the local audio state changes.
firstLocalAudioFramePublished Occurs when the first audio frame is published.

Remote media events

Event Description
remoteAudioStateChangedOfUid Occurs when the remote audio state changes.

Statistics events

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.
remoteVideoStats Reports the statistics of the video stream from each remote user/host.

Audio volume indication

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.

Audio route control

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.

Music file playback and mixing

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.
Event Description
audioMixingStateChanged Occurs when the state of the local user's audio mixing file changes.

Voice changer and reverberation

Method Function
setLocalVoiceChanger Sets the local voice changer option.
setLocalVoiceReverbPreset Sets the preset local voice reverberation effect.

In-ear monitor

This group of methods is for iOS only.

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

Last-mile test

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.

Camera control

This group of methods is for iOS only.

Method Function
switchCamera Switches between front and rear cameras.

Dual video stream

Method Function
enableDualStreamMode Enables/Disables the dual-stream mode.
setRemoteDefaultVideoStreamType Sets the default video stream type of the remote stream.

External video data (push-mode only)

Method Function
setExternalVideoSource Configures the external video source.
pushExternalVideoFrame Pushes the external video frame.

Miscellaneous methods

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 level of the SDK.

Miscellaneous events

Event Description
didApiCallExecute Occurs when an API method is executed.