Agora RTC Objective-C API Reference  Refactor
<AgoraRtcEngineDelegate> Protocol Reference

Inherits <NSObject>.

Core Delegate Methods


(void) - rtcEngineRequestToken:
 
(void) - rtcEngine:tokenPrivilegeWillExpire:
 
(void) - rtcEngineConnectionDidLost:
 
(void) - rtcEngine:networkTypeChanged:
 
(void) - rtcEngine:permissionError:
 
(void) - rtcEngine:connectionStateChanged:reason:
 
(void) - rtcEngine:reportRtcStats:
 
(void) - rtcEngine:lastmileProbeTestResult:
 
(void) - rtcEngine:didApiCallExecute:api:result:
 
(void) - rtcEngine:uploadLogResultRequestId:success:reason:
 

Local User Core Delegate Methods


(void) - rtcEngine:didJoinChannel:withUid:elapsed:
 
(void) - rtcEngine:didRejoinChannel:withUid:elapsed:
 
(void) - rtcEngine:didClientRoleChanged:newRole:
 
(void) - rtcEngine:didClientRoleChangeFailed:currentRole:
 
(void) - rtcEngine:didLeaveChannelWithStats:
 

Local User Audio Delegate Methods


(void) - rtcEngine:firstLocalAudioFramePublished:
 
(void) - rtcEngine:localAudioStats:
 
(void) - rtcEngine:localAudioStateChanged:error:
 

Local User Video Delegate Methods


(void) - rtcEngine:cameraExposureDidChangedToRect:
 
(void) - rtcEngine:firstLocalVideoFramePublishedWithElapsed:
 

Remote User Core Delegate Methods


(void) - rtcEngine:didJoinedOfUid:elapsed:
 
(void) - rtcEngine:didOfflineOfUid:reason:
 

Remote User Audio Delegate Methods


(void) - rtcEngine:firstRemoteAudioFrameDecodedOfUid:elapsed:
 
(void) - rtcEngine:remoteAudioStats:
 
(void) - rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:
 
(void) - rtcEngineIntraRequestReceived:
 
(void) - rtcEngine:uplinkNetworkInfoUpdate:
 
(void) - rtcEngine:downlinkNetworkInfoUpdate:
 
(void) - rtcEngine:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:
 
(void) - rtcEngine:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:
 
(void) - rtcEngine:didLocalUserRegisteredWithUserId:userAccount:
 
(void) - rtcEngine:didUserInfoUpdatedWithUserId:userInfo:
 

Remote User Video Delegates Methods


(void) - rtcEngine:localVideoStateChangedOfState:error:
 
(void) - rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed:
 
(void) - rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:
 
(void) - rtcEngine:channelMediaRelayStateDidChange:error:
 
(void) - rtcEngine:didReceiveChannelMediaRelayEvent:
 
(void) - rtcEngine:remoteUserStateChangedOfUid:state:
 
(void) - rtcEngine:remoteVideoStats:
 
(void) - rtcEngine:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:
 
(void) - rtcEngine:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:
 

CDN Live Streaming Delegate Methods


(void) - rtcEngine:rtmpStreamingChangedToState:state:errCode:
 
(void) - rtcEngine:rtmpStreamingEventWithUrl:eventCode:
 
(void) - rtcEngine:audioMixingStateChanged:errorCode:
 

Face Detection Delegate Methods


(void) - rtcEngine:facePositionDidChangeWidth:previewHeight:faces:
 

Detailed Description

The AgoraRtcEngineDelegate protocol enables callback event notifications to your application.

The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the application. From v1.1, some block callbacks in the SDK are replaced with delegate callbacks. The old block callbacks are therefore deprecated, but can still be used in the current version. However, Agora recommends replacing block callbacks with delegate callbacks. The SDK calls the block callback if a callback is defined in both the block and delegate callbacks.

Method Documentation

◆ rtcEngineRequestToken:

- (void) rtcEngineRequestToken: (AgoraRtcEngineKit *_Nonnull)  engine

Occurs when the token has expired.

If a token is specified when calling joinChannelByToken, the token expires after a certain period of time and you need a new token to reconnect to the server.

Upon receiving this callback, generate a new token at your app server and call renewToken to pass the new token to the SDK.

Parameters
engineThe AgoraRtcEngineKit object.
See also
How to generate a token.

◆ rtcEngine:tokenPrivilegeWillExpire:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
tokenPrivilegeWillExpire: (NSString *_Nonnull)  token 

Occurs when the token will expire in 30 seconds.

If the token you specified when calling joinChannelByToken expires, the user drops offline. This callback is triggered 30 seconds before the token expires, to remind you to renew the token. Upon receiving this callback, generate a new token at your app server and call renewToken to pass the new token to the SDK.

Parameters
engineThe AgoraRtcEngineKit object.
tokenThe token that will expire in 30 seconds.

◆ rtcEngineConnectionDidLost:

- (void) rtcEngineConnectionDidLost: (AgoraRtcEngineKit *_Nonnull)  engine

Occurs when the SDK cannot reconnect to Agora's edge server 10 seconds after its connection to the server is interrupted.

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling joinChannelByToken, regardless of whether it is in the channel or not.

Parameters
engineThe AgoraRtcEngineKit object.

◆ rtcEngine:networkTypeChanged:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
networkTypeChanged: (AgoraNetworkType type 

Occurs when the connection state of the SDK to the server is changed.

Parameters
engineThe AgoraRtcEngineKit object.
typeSee AgoraNetworkType.

◆ rtcEngine:permissionError:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
permissionError: (AgoraPermissionType type 

Occurs when permission error

Parameters
engineThe AgoraRtcEngineKit object.
typeSee AgoraPermissionType.

◆ rtcEngine:connectionStateChanged:reason:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
connectionStateChanged: (AgoraConnectionState state
reason: (AgoraConnectionChangedReason reason 

Occurs when the connection state of the SDK to the server is changed.

Parameters
engineThe AgoraRtcEngineKit object.
stateSee AgoraConnectionState.
reasonSee AgoraConnectionChangedReason.

◆ rtcEngine:reportRtcStats:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
reportRtcStats: (AgoraChannelStats *_Nonnull)  stats 

Reports the statistics of the current call.

This callback is triggered once every two seconds after the user joins the channel.

Parameters
engineThe AgoraRtcEngineKit object.
statsThe statistics on the current call: AgoraChannelStats.

◆ rtcEngine:lastmileProbeTestResult:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
lastmileProbeTestResult: (AgoraLastmileProbeResult *_Nonnull)  result 

Reports the last-mile network probe result.

The SDK triggers this callback within 30 seconds after the app calls the startLastmileProbeTest method.

Parameters
engineThe AgoraRtcEngineKit object.
resultThe uplink and downlink last-mile network probe test result, see AgoraLastmileProbeResult.

◆ rtcEngine:didApiCallExecute:api:result:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didApiCallExecute: (NSInteger)  error
api: (NSString *_Nonnull)  api
result: (NSString *_Nonnull)  result 

The API call was executed successfully.

Parameters
engineThe AgoraRtcEngineKit object.
errorAgoraErrorCode
apiThe method executed by the SDK.
resultThe result of the method call.

◆ rtcEngine:uploadLogResultRequestId:success:reason:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
uploadLogResultRequestId: (NSString *_Nonnull)  requestId
success: (BOOL)  success
reason: (AgoraUploadErrorReason reason 

Reports the user log upload result

Parameters
requestIdRequestId of the upload
successIs upload success
reasonReason of the upload, 0: OK, 1 Network Error, 2 Server Error.

◆ rtcEngine:didJoinChannel:withUid:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didJoinChannel: (NSString *_Nonnull)  channel
withUid: (NSUInteger)  uid
elapsed: (NSInteger)  elapsed 

Occurs when the local user successfully joins a specified channel.

Parameters
engineAgoraRtcEngineKit object
channelThe channel name.
uidThe user ID.
elapsedThe time elapsed (ms) from the local user calling joinChannelByToken until this event occurs.

◆ rtcEngine:didRejoinChannel:withUid:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didRejoinChannel: (NSString *_Nonnull)  channel
withUid: (NSUInteger)  uid
elapsed: (NSInteger)  elapsed 

Occurs when the local user rejoins a channel.

If the client loses connection with the server because of network problems, the SDK automatically attempts to reconnect and then triggers this callback upon reconnection, indicating that the user rejoins the channel with the assigned channel ID and user ID.

Parameters
engineThe AgoraRtcEngineKit object.
channelThe channel name.
uidThe user ID.
elapsedTime elapsed (ms) from the local user calling joinChannelByToken until this event occurs.

◆ rtcEngine:didClientRoleChanged:newRole:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didClientRoleChanged: (AgoraClientRole oldRole
newRole: (AgoraClientRole newRole 

Occurs when the local user role switches in a live broadcast.

Parameters
engineThe AgoraRtcEngineKit object.
oldRoleThe role that the user switches from: AgoraClientRole.
newRoleThe role that the user switches to: AgoraClientRole.

◆ rtcEngine:didClientRoleChangeFailed:currentRole:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didClientRoleChangeFailed: (AgoraClientRoleChangeFailedReason reason
currentRole: (AgoraClientRole currentRole 

Occurs when the local user role switches in a live broadcast.

Parameters
engineThe AgoraRtcEngineKit object.
reasonThe reason of the failure of the local user role switches: AgoraClientRoleChangeFailedReason.
currentRoleThe current role of the user: AgoraClientRole.

◆ rtcEngine:didLeaveChannelWithStats:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didLeaveChannelWithStats: (AgoraChannelStats *_Nonnull)  stats 

Occurs when the local user leaves a channel.

When the user successfully leaves the channel after calling leaveChannel method, this callback notifies the app that a user leaves a channel.

This callback also reports information such as the call duration and the statistics of data received or transmitted by the SDK.

Parameters
engineThe AgoraRtcEngineKit object.
statsThe statistics of the call. See AgoraChannelStats.

◆ rtcEngine:firstLocalAudioFramePublished:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
firstLocalAudioFramePublished: (NSInteger)  elapsed 

Occurs when the first local audio frame is published.

Parameters
engineThe AgoraRtcEngineKit object.
elapsedThe time elapsed (ms) from calling joinChannelByToken until the SDK triggers this callback.

◆ rtcEngine:localAudioStats:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
localAudioStats: (AgoraRtcLocalAudioStats *_Nonnull)  stats 

Reports the statistics of the local audio stream.

The SDK triggers this callback once every two seconds.

Parameters
engineThe AgoraRtcEngineKit object.
statsThe statistics of the local audio stream. See AgoraRtcLocalAudioStats.

◆ rtcEngine:localAudioStateChanged:error:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
localAudioStateChanged: (AgoraAudioLocalState state
error: (AgoraAudioLocalError error 

Occurs when the local audio stream state changes.

This callback indicates the state change of the local audio stream, including the state of the audio recording and encoding, and allows you to troubleshoot issues when exceptions occur.

Note
When the state is AgoraAudioLocalStateFailed(3), see the error parameter for details.
Parameters
engineAgoraRtcEngineKit object
stateThe state of the local audio. See AgoraAudioLocalState.
errorThe error information of the local audio. See AgoraAudioLocalError.

◆ rtcEngine:cameraExposureDidChangedToRect:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
cameraExposureDidChangedToRect: (CGRect)  rect 

A camera exposure position changed.

Parameters
engineAgoraRtcEngineKit object
rectExposure rectangle in the local preview

◆ rtcEngine:firstLocalVideoFramePublishedWithElapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
firstLocalVideoFramePublishedWithElapsed: (NSInteger)  elapsed 

Event of the first local video frame is published.

Parameters
engineThe engine kit
elapsedThe elapsed time(ms) from the beginning of the session.

◆ rtcEngine:didJoinedOfUid:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didJoinedOfUid: (NSUInteger)  uid
elapsed: (NSInteger)  elapsed 

Occurs when a remote user or user joins the channel.

If other users or hosts are already in the channel, the SDK also reports to the app on the existing users/hosts.

The SDK triggers this callback under one of the following circumstances:

  • A remote user/host joins the channel by calling joinChannelByToken.
  • A remote user switches the user role to the host by calling setClientRole method after joining the channel.
  • A remote user/host rejoins the channel after a network interruption.
    Note
    When a web user joins the channel, this callback is triggered as long as the user publishes a stream.
    Parameters
    engineThe AgoraRtcEngineKit object.
    uidThe user ID.
    elapsedTime elapsed (ms) from calling joinChannelByToken until this callback is triggered.

◆ rtcEngine:didOfflineOfUid:reason:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didOfflineOfUid: (NSUInteger)  uid
reason: (AgoraUserOfflineReason reason 

Occurs when a remote user or host goes offline.

There are two reasons for a user to go offline:

  • Leave the channel: When the user leaves the channel, the user sends a goodbye message. When this message is received, the SDK determines that the user leaves the channel.
  • Drop offline: When no data packet of the user is received for a certain period of time, the SDK assumes that the user drops offline. A poor network connection may lead to false detection, so we recommend using the RTM SDK for reliable offline detection.
Parameters
engineThe AgoraRtcEngineKit object.
uidThe ID of the user who goes offline.
reasonThe reason why the user goes offline: AgoraUserOfflineReason.

◆ rtcEngine:firstRemoteAudioFrameDecodedOfUid:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
firstRemoteAudioFrameDecodedOfUid: (NSUInteger)  uid
elapsed: (NSInteger)  elapsed 

Occurs when the SDK decodes the first remote audio frame for playback.

Deprecated** from v3.0.0. Use AgoraAudioRemoteStateDecoding(2) in the [remoteAudioStateChangedOfUid]([AgoraRtcEngineDelegate rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:]) callback instead.

This callback is triggered in either of the following scenarios:

  • The remote user joins the channel and sends the audio stream.
  • The remote user stops sending the audio stream and re-sends it after 15 seconds. Reasons for such an interruption include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls the [muteLocalAudioStream]([AgoraRtcEngineKit muteLocalAudioStream:]) method to stop sending the local audio stream.
    • The remote user calls the [disableAudio]([AgoraRtcEngineKit disableAudio]) method to disable audio.
Parameters
engineAgoraRtcEngineKit object.
uidUser ID of the remote user sending the audio stream.
elapsedThe time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

◆ rtcEngine:remoteAudioStats:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
remoteAudioStats: (AgoraRtcRemoteAudioStats *_Nonnull)  stats 

Reports the statistics of the remote audio stream.

The SDK triggers this callback once every two seconds for each remote user or broadcaster. If a channel has multiple remote users, the SDK triggers this callback as many times.

Parameters
engineThe AgoraRtcEngineKit object.
statsThe statistics of the received audio. See AgoraRtcRemoteAudioStats.

◆ rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
reportAudioVolumeIndicationOfSpeakers: (NSArray< AgoraRtcAudioVolumeInfo * > *_Nonnull)  speakers
totalVolume: (NSInteger)  totalVolume 

This callback reports the IDs and volumes of the loudest speakers at the moment in the channel, and whether the local user is speaking.

Once enabled, this callback is triggered at the set interval, regardless of whether a user speaks or not.

The SDK triggers two independent reportAudioVolumeIndicationOfSpeakers callbacks at one time, which separately report the volume information of the local user and all the remote speakers.

Parameters
engineThe AgoraRtcEngineKit object.
speakersAn array containing the user ID and volume information for each speaker: AgoraRtcAudioVolumeInfo.
  • In the local user's callback, this array contains the following members:
    • uid = 0,
    • volume = totalVolume, which reports the sum of the voice volume and audio-mixing volume of the local user.
  • In the remote users' callback, this array contains the following members:
    • uid of each remote speaker.
    • volume, which reports the sum of the voice volume and audio-mixing volume of each remote speaker. An empty speakers array in the callback indicates that no remote user is speaking at the moment.
totalVolumeThe total volume after audio mixing. The value ranges between 0 (the lowest volume) and 255 (the highest volume).
  • In the local user's callback, totalVolume is the sum of the voice volume and audio-mixing volume of the local user.
  • In the remote users' callback, totalVolume is the sum of the voice volume and audio-mixing volume of all the remote speakers.

◆ rtcEngineIntraRequestReceived:

- (void) rtcEngineIntraRequestReceived: (AgoraRtcEngineKit *_Nonnull)  engine

Intra request received.

Parameters
engineThe AgoraRtcEngineKit object.

◆ rtcEngine:uplinkNetworkInfoUpdate:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
uplinkNetworkInfoUpdate: (AgoraUplinkNetworkInfo *_Nonnull)  networkInfo 

Target bitrate updated.

Parameters
engineThe AgoraRtcEngineKit object.
networkInfoThe uplink network info, including target bitrate bps.

◆ rtcEngine:downlinkNetworkInfoUpdate:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
downlinkNetworkInfoUpdate: (AgoraDownlinkNetworkInfo *_Nonnull)  networkInfo 

Downlink network info updated.

Parameters
engineThe AgoraRtcEngineKit object.
networkInfoThe network info.

◆ rtcEngine:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didAudioSubscribeStateChange: (NSString *_Nonnull)  channelId
uid: (unsigned int)  uid
oldState: (AgoraStreamSubscribeState oldState
newState: (AgoraStreamSubscribeState newState
elapseSinceLastState: (int)  elapseSinceLastState 

Occurs when the audio subscribe state changed.

Parameters
engineThe AgoraRtcEngineKit object.
channelIdThe channel name of user joined.
uidThe remote user ID that is subscribed to.
oldStateThe old state of the audio stream subscribe : AgoraStreamSubscribeState.
newStateThe new state of the audio stream subscribe : AgoraStreamSubscribeState.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ rtcEngine:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didAudioPublishStateChange: (NSString *_Nonnull)  channelId
oldState: (AgoraStreamPublishState oldState
newState: (AgoraStreamPublishState newState
elapseSinceLastState: (int)  elapseSinceLastState 

Occurs when the audio publish state changed.

Parameters
channelIdThe channel name of user joined.
oldStateThe old state of the audio stream publish : AgoraStreamPublishState.
newStateThe new state of the audio stream publish : AgoraStreamPublishState.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ rtcEngine:didLocalUserRegisteredWithUserId:userAccount:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didLocalUserRegisteredWithUserId: (NSUInteger)  uid
userAccount: (NSString *_Nonnull)  userAccount 

Occurs when the local user successfully registers a user account by calling the This callback reports the user ID and user account of the local user.

Parameters
engineThe AgoraRtcEngineKit object.
uidThe ID of the local user.
userAccountThe user account of the local user.

◆ rtcEngine:didUserInfoUpdatedWithUserId:userInfo:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didUserInfoUpdatedWithUserId: (NSUInteger)  uid
userInfo: (AgoraUserInfo *_Nonnull)  userInfo 

Occurs when the SDK gets the user ID and user account of the remote user.

After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object (userInfo), and triggers this callback on the local client.

Parameters
engineThe AgoraRtcEngineKit object.
uidThe ID of the remote user.
userInfoThe AgoraUserInfo object that contains the user ID and user account of the remote user.

◆ rtcEngine:didRhythmPlayerStateChanged:errorCode:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didRhythmPlayerStateChanged: (AgoraRhythmPlayerState state
errorCode: (AgoraRhythmPlayerError errorCode 

◆ rtcEngine:contentInspectResult:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
contentInspectResult: (AgoraContentInspectResult result 

◆ rtcEngine:snapshotTaken:uid:filePath:width:height:errCode:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
snapshotTaken: (NSString *_Nonnull)  channel
uid: (NSUInteger)  uid
filePath: (NSString *_Nonnull)  filePath
width: (NSInteger)  width
height: (NSInteger)  height
errCode: (NSInteger)  errCode 

◆ rtcEngine:localVideoStateChangedOfState:error:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
localVideoStateChangedOfState: (AgoraVideoLocalState state
error: (AgoraLocalVideoStreamError error 

Occurs when the local video stream state changes.

This callback indicates the state of the local video stream, including camera capturing and video encoding, and allows you to troubleshoot issues when exceptions occur.

Note
For some device models, the SDK will not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.
Parameters
engineAgoraRtcEngineKit object
stateState type AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the error parameter for details.
errorThe detailed error information: AgoraLocalVideoStreamError.

◆ rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
remoteVideoStateChangedOfUid: (NSUInteger)  uid
state: (AgoraVideoRemoteState)  state
reason: (AgoraVideoRemoteReason reason
elapsed: (NSInteger)  elapsed 

Occurs when the remote video state has changed.

Note
This callback does not work properly when the number of users (in the AgoraChannelProfileCommunication profile) or hosts (in the AgoraChannelProfileLiveBroadcasting profile) in the channel exceeds 17.
Parameters
engineAgoraRtcEngineKit object.
uidID of the user whose video state has changed.
stateThe remote video state: #AgoraVideoRemoteState.
reasonThe reason of the remote video state change: AgoraVideoRemoteReason.
elapsedThe time elapsed (ms) from the local user calling joinChannel until this callback is triggered.

◆ rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
remoteAudioStateChangedOfUid: (NSUInteger)  uid
state: (AgoraAudioRemoteState state
reason: (AgoraAudioRemoteReason reason
elapsed: (NSInteger)  elapsed 

Occurs when the state of a remote audio stream changes.

Parameters
engineThe AgoraRtcEngineKit object.
uidThe ID of the user whose audio state has changed.
stateThe state of the remote audio. See AgoraAudioRemoteState.
reasonThe reason of the remote audio state change. See AgoraAudioRemoteReason.
elapsedThe time elapsed (ms) from calling joinChannelByToken until the SDK triggers this callback.

◆ rtcEngine:channelMediaRelayStateDidChange:error:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
channelMediaRelayStateDidChange: (AgoraChannelMediaRelayState state
error: (AgoraChannelMediaRelayError error 

Occurs when the state of the media stream relay changes.

The SDK reports the state of the current media relay and possible error messages in this callback.

Parameters
engineAgoraRtcEngineKit object.
stateThe state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState).
errorThe error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError).

◆ rtcEngine:didReceiveChannelMediaRelayEvent:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didReceiveChannelMediaRelayEvent: (AgoraChannelMediaRelayEvent event 

Reports events during the media stream relay.

Parameters
engineAgoraRtcEngineKit object.
eventThe event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent).

◆ rtcEngine:remoteUserStateChangedOfUid:state:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
remoteUserStateChangedOfUid: (NSUInteger)  uid
state: (NSUInteger)  state 

Occurs when the remote user state is updated.

Parameters
engineThe AgoraRtcEngineKit object.
uidRemote user ID.
stateThe remote user state.

◆ rtcEngine:remoteVideoStats:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
remoteVideoStats: (AgoraRtcRemoteVideoStats *_Nonnull)  stats 

Reports the statistics of the video stream from each remote user/host.

The SDK triggers this callback once every two seconds for each remote user or host. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters
engineThe AgoraRtcEngineKit object.
statsThe statistics of the received remote video streams. See AgoraRtcRemoteVideoStats.

◆ rtcEngine:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didVideoSubscribeStateChange: (NSString *_Nonnull)  channelId
uid: (unsigned int)  uid
oldState: (AgoraStreamSubscribeState oldState
newState: (AgoraStreamSubscribeState newState
elapseSinceLastState: (int)  elapseSinceLastState 

Occurs when the video subscribe state changed.

Parameters
engineThe AgoraRtcEngineKit object.
channelIdThe channel name of user joined.
uidThe remote user ID that is subscribed to.
oldStateThe old state of the video stream subscribe : AgoraStreamSubscribeState.
newStateThe new state of the video stream subscribe : AgoraStreamSubscribeState.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ rtcEngine:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
didVideoPublishStateChange: (NSString *_Nonnull)  channelId
oldState: (AgoraStreamPublishState oldState
newState: (AgoraStreamPublishState newState
elapseSinceLastState: (int)  elapseSinceLastState 

Occurs when the video publish state changed.

Parameters
engineThe AgoraRtcEngineKit object.
channelIdThe channel name of user joined.
oldStateThe old state of the video stream publish : AgoraStreamPublishState.
newStateThe new state of the video stream publish : AgoraStreamPublishState.
elapseSinceLastStateThe time elapsed (ms) from the old state to the new state.

◆ rtcEngine:rtmpStreamingChangedToState:state:errCode:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
rtmpStreamingChangedToState: (NSString *_Nonnull)  url
state: (AgoraRtmpStreamingState state
errCode: (AgoraRtmpStreamingErrorCode errCode 

Occurs when the state of the RTMP or RTMPS streaming changes.

The SDK triggers this callback to report the result of the local user calling the [addPublishStreamUrl](addPublishStreamUrl:transcodingEnabled:) or [removePublishStreamUrl](removePublishStreamUrl:) method.

This callback returns the URL and its current streaming state.

This callback indicates the state of the RTMP or RTMPS streaming. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the errorCode parameter.

Parameters
engineAgoraRtcEngineKit object.
urlThe CDN streaming URL.
stateThe RTMP or RTMPS streaming state: AgoraRtmpStreamingState.
errCodeThe detailed error information for streaming: AgoraRtmpStreamingErrorCode.

◆ rtcEngine:rtmpStreamingEventWithUrl:eventCode:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
rtmpStreamingEventWithUrl: (NSString *_Nonnull)  url
eventCode: (AgoraRtmpStreamingEvent eventCode 

Reports events during the RTMP or RTMPS streaming.

Since
v3.1.0
Parameters
engineAgoraRtcEngineKit object.
urlThe RTMP or RTMPS streaming URL.
eventCodeThe event code. See AgoraRtmpStreamingEvent.

◆ rtcEngine:audioMixingStateChanged:errorCode:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
audioMixingStateChanged: (AgoraAudioMixingStateType)  state
errorCode: (AgoraAudioMixingErrorType)  errorCode 

Audio mixing state changed.

Parameters
engineThe AgoraRtcEngineKit object.
stateAgoraAudioMixingStateType
errorCodeAgoraAudioMixingErrorType

◆ rtcEngine:facePositionDidChangeWidth:previewHeight:faces:

- (void) rtcEngine: (AgoraRtcEngineKit *_Nonnull)  engine
facePositionDidChangeWidth: (int)  width
previewHeight: (int)  height
faces: (NSArray< AgoraFacePositionInfo * > *_Nullable)  faces 

Reports the face detection result of the local user. (iOS only)

Since:** v3.0.1.

Once you enable face detection by calling [enableFaceDetection]([AgoraRtcEngineKit enableFaceDetection:]), you can get the following information on the local user in real-time:

  • The width and height of the local video.
  • The position of the human face in the local video.
  • The distance between the human face and the device screen. This value is based on the fitting calculation of the local video size and the position of the human face.

    Note**

  • If the SDK does not detect a face, it reduces the frequency of this callback to reduce power consumption on the local device.
  • The SDK stops triggering this callback when a human face is in close proximity to the screen.
Parameters
engineAgoraRtcEngineKit object.
widthThe width (px) of the local video.
heightThe height (px) of the local video.
facesAn AgoraFacePositionInfo array, which contains the information of the detected human face.

The number of the AgoraFacePositionInfo array depends on the number of human faces detected. If the array length is 0, it means that no human face is detected.