Agora RTC Objective-C API Reference Refactor

<AgoraRtcEngineDelegate> Protocol Reference

Inherits <NSObject>.

## Core Delegate Methods
##
(void) | - rtcEngineRequestToken:
(void) | - rtcEngine:tokenPrivilegeWillExpire:
(void) | - rtcEngine:licenseValidationFailure:
(void) | - rtcEngineConnectionDidLost:
(void) | - rtcEngine:networkTypeChanged:
(void) | - rtcEngine:permissionError:
(void) | - rtcEngine:connectionChangedToState:reason:
(void) | - rtcEngine:wlAccMessage:action:wlAccMsg:
(void) | - rtcEngine:wlAccStats:averageStats:
(void) | - rtcEngine:reportRtcStats:
(void) | - rtcEngine:lastmileProbeTestResult:
(void) | - rtcEngine:uploadLogResultRequestId:success:reason:

## Local User Core Delegate Methods
##
(void) | - rtcEngine:didJoinChannel:withUid:elapsed:
(void) | - rtcEngine:didRejoinChannel:withUid:elapsed:
(void) | - rtcEngine:didClientRoleChanged:newRole:newRoleOptions:
(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:sourceType:
(void) | - rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:
(void) | - rtcEngine:localVideoStats:sourceType:
(void) | - rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:

## 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:
(void) | - rtcEngine:didLocalVideoTranscoderErrorWithStream:errorCode:

## Remote User Video Delegates Methods
##
(void) | - rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation:
(void) | - rtcEngine:localVideoStateChangedOfState:error:sourceType:
(void) | - rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed:
(void) | - rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:
(void) | - rtcEngine:channelMediaRelayStateDidChange:error:
(void) | - rtcEngine:didReceiveChannelMediaRelayEvent:
(void) | - rtcEngine:didProxyConnected:withUid:proxyType:localProxyIp:elapsed:
(void) | - rtcEngine:remoteUserStateChangedOfUid:state:
(void) | - rtcEngine:remoteVideoStats:
(void) | - rtcEngine:didVideoSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:
(void) | - rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:

## CDN Live Streaming Delegate Methods
##
(void) | - rtcEngine:rtmpStreamingChangedToState:state:errCode:
(void) | - rtcEngine:rtmpStreamingEventWithUrl:eventCode:
(void) | - rtcEngine:audioMixingStateChanged:reasonCode:
(void) | - rtcEngine:audioMixingPositionChanged:

## 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: (AgoraRtcEngineKit) renewToken to pass the new token to the SDK.

Parameters

  engine | The 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: (AgoraRtcEngineKit) renewToken to pass the new token to the SDK.

Parameters

  engine | The AgoraRtcEngineKit object.
  token | The token that will expire in 30 seconds.

## ◆ rtcEngine:licenseValidationFailure:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
licenseValidationFailure: |  | (AgoraLicenseVerifyCode) | error

Occurs when connection license verification fails

You can know the reason accordding to error code

## ◆ 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

  engine | The 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

  engine | The AgoraRtcEngineKit object.
  type | See AgoraNetworkType.

## ◆ rtcEngine:permissionError:

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

Occurs when permission error

Parameters

  engine | The AgoraRtcEngineKit object.
  type | See AgoraPermissionType.

## ◆ rtcEngine:connectionChangedToState:reason:

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

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

Parameters

  engine | The AgoraRtcEngineKit object.
  state | See AgoraConnectionState.
  reason | See AgoraConnectionChangedReason.

## ◆ rtcEngine:wlAccMessage:action:wlAccMsg:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
wlAccMessage: |  | (AgoraWlAccReason) | reason
action: |  | (AgoraWlAccAction) | action
wlAccMsg: |  | (NSString *_Nonnull) | wlAccMsg

Reports WIFI user message. When the user needs to be prompted to approach the AP or switch the frequency band connected to the AP, the SDK will trigger this callback to notify the APP.

Parameters

  engine | AgoraRtcEngineKit object.
  reason | The reason of notifying the user of a message.
  action | Suggest an action for the user.
  wlAccMsg | The message content of notifying the user.

## ◆ rtcEngine:wlAccStats:averageStats:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
wlAccStats: |  | (AgoraWlAccStats *_Nonnull) | currentStats
averageStats: |  | (AgoraWlAccStats *_Nonnull) | averageStats

Reports WIFI accelerate status. When the optimized end-to-end delay, frozen ratio and packet loss rate need to be displayed to the user, the SDK will trigger this callback to notify the APP.

Parameters

  engine | AgoraRtcEngineKit object.
  currentStats | Instantaneous value of optimization effect.
  averageStats | Average value of cumulative optimization effect.

## ◆ 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

  engine | The AgoraRtcEngineKit object.
  stats | The 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: (AgoraRtcEngineKit) startLastmileProbeTest method.

Parameters

  engine | The AgoraRtcEngineKit object.
  result | The uplink and downlink last-mile network probe test result, see AgoraLastmileProbeResult.

## ◆ 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

  requestId | RequestId of the upload
  success | Is upload success
  reason | Reason 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

  engine | AgoraRtcEngineKit object
  channel | The channel name.
  uid | The user ID.
  elapsed | The 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

  engine | The AgoraRtcEngineKit object.
  channel | The channel name.
  uid | The user ID.
  elapsed | Time elapsed (ms) from the local user calling `joinChannelByToken` until this event occurs.

## ◆ rtcEngine:didClientRoleChanged:newRole:newRoleOptions:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
didClientRoleChanged: |  | (AgoraClientRole) | oldRole
newRole: |  | (AgoraClientRole) | newRole
newRoleOptions: |  | (AgoraClientRoleOptions *_Nullable) | newRoleOptions

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

Parameters

  engine | The AgoraRtcEngineKit object.
  oldRole | The role that the user switches from: AgoraClientRole.
  newRole | The role that the user switches to: AgoraClientRole.
  newRoleOptions | The client role option of the new role: AgoraClientRoleOptions.

## ◆ 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

  engine | The AgoraRtcEngineKit object.
  reason | The reason of the failure of the local user role switches: AgoraClientRoleChangeFailedReason.
  currentRole | The 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: (AgoraRtcEngineKit) 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

  engine | The AgoraRtcEngineKit object.
  stats | The 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

  engine | The AgoraRtcEngineKit object.
  elapsed | The 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

  engine | The AgoraRtcEngineKit object.
  stats | The 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

  engine | AgoraRtcEngineKit object
  state | The state of the local audio. See AgoraAudioLocalState.
  error | The error information of the local audio. See AgoraAudioLocalError.

## ◆ rtcEngine:cameraExposureDidChangedToRect:

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

A camera exposure position changed.

Parameters

  engine | AgoraRtcEngineKit object
  rect | Exposure rectangle in the local preview

## ◆ rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType:

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

Event of the first local video frame is published.

Parameters

  engine | The engine kit
  elapsed | The elapsed time(ms) from the beginning of the session.
  sourceType | source type of the orignated video source. See AgoraVideoSourceType.

## ◆ rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
firstLocalVideoFrameWithSize: |  | (CGSize) | size
elapsed: |  | (NSInteger) | elapsed
sourceType: |  | (AgoraVideoSourceType) | sourceType

The first local frame displayed on the video window.

Same as [firstLocalVideoFrameBlock]([AgoraRtcEngineKit firstLocalVideoFrameBlock:]).

Parameters

  engine | The AgoraRtcEngineKit object.
  size | Size of the video (width and height).
  elapsed | Time elapsed (ms) from calling `joinChannelByToken` until this callback is triggered.
  sourceType | source type of the orignated video source. See AgoraVideoSourceType.

## ◆ rtcEngine:localVideoStats:sourceType:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
localVideoStats: |  | (AgoraRtcLocalVideoStats *_Nonnull) | stats
sourceType: |  | (AgoraVideoSourceType) | sourceType

Reports the statistics of the local video stream.

The SDK triggers this callback once every two seconds for each user/host. If there are multiple users/hosts in the channel, the SDK triggers this callback as many times.

Note
  If you have called the enableDualStreamMode: (AgoraRtcEngineKit) enableDualStreamMode method, this callback reports the statistics of the high-video stream (high bitrate, and high-resolution video stream).

Parameters

  engine | The AgoraRtcEngineKitobject.
  stats | Statistics of the local video stream. See AgoraRtcLocalVideoStats.
  sourceType | source type of the orignated video source. See AgoraVideoSourceType.

## ◆ rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
videoRenderingTracingResultOfUid: |  | (NSUInteger) | uid
currentEvent: |  | (AgoraMediaTraceEvent) | currentEvent
tracingInfo: |  | (AgoraVideoRenderingTracingInfo *_Nonnull) | tracingInfo

Reports the tracing result of video rendering event of the user.

Parameters

  uid | The user ID.
  currentEvent | The current event of the tracing result: AgoraMediaTraceEvent.
  tracingInfo | The tracing result: AgoraVideoRenderingTracingInfo.

## ◆ 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: (AgoraRtcEngineKit) 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

    engine | The AgoraRtcEngineKit object.
    uid | The user ID.
    elapsed | Time 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

  engine | The AgoraRtcEngineKit object.
  uid | The ID of the user who goes offline.
  reason | The 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

  engine | AgoraRtcEngineKit object.
  uid | User ID of the remote user sending the audio stream.
  elapsed | The 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

  engine | The AgoraRtcEngineKit object.
  stats | The 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

  engine | The AgoraRtcEngineKit object.
  speakers | An 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.
  totalVolume | The 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

  engine | The AgoraRtcEngineKit object.

## ◆ rtcEngine:uplinkNetworkInfoUpdate:

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

Target bitrate updated.

Parameters

  engine | The AgoraRtcEngineKit object.
  networkInfo | The uplink network info, including target bitrate bps.

## ◆ rtcEngine:downlinkNetworkInfoUpdate:

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

Downlink network info updated.

Parameters

  engine | The AgoraRtcEngineKit object.
  networkInfo | The 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

  engine | The AgoraRtcEngineKit object.
  channelId | The channel name of user joined.
  uid | The remote user ID that is subscribed to.
  oldState | The old state of the audio stream subscribe : AgoraStreamSubscribeState.
  newState | The new state of the audio stream subscribe : AgoraStreamSubscribeState.
  elapseSinceLastState | The 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

  channelId | The channel name of user joined.
  oldState | The old state of the audio stream publish : AgoraStreamPublishState.
  newState | The new state of the audio stream publish : AgoraStreamPublishState.
  elapseSinceLastState | The 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

  engine | The AgoraRtcEngineKit object.
  uid | The ID of the local user.
  userAccount | The 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

  engine | The AgoraRtcEngineKit object.
  uid | The ID of the remote user.
  userInfo | The `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:didLocalVideoTranscoderErrorWithStream:errorCode:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
didLocalVideoTranscoderErrorWithStream: |  | (AgoraTranscodingVideoStream *_Nonnull) | stream
errorCode: |  | (AgoraVideoTranscoderError) | errorCode

Occurs when local video transcoder stream has error.

Parameters

  stream | Stream type of AgoraTranscodingVideoStream.
  errorCode | Error code of AgoraVideoTranscoderError.

## ◆ rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
videoSizeChangedOfSourceType: |  | (AgoraVideoSourceType) | sourceType
uid: |  | (NSUInteger) | uid
size: |  | (CGSize) | size
rotation: |  | (NSInteger) | rotation

Occurs when the local or remote video size or rotation has changed.

Parameters

  engine | AgoraRtcEngineKit object.
  sourceType | The video source type.
  uid | The user ID. 0 indicates the local user.
  size | Size of the video (width and height) in pixels.
  rotation | The rotation information of the video.

## ◆ rtcEngine:contentInspectResult:

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

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

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

## ◆ rtcEngine:localVideoStateChangedOfState:error:sourceType:

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

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

  engine | AgoraRtcEngineKit object
  state | State type AgoraVideoLocalState. When the state is AgoraVideoLocalStateFailed (3), see the `error` parameter for details.
  error | The detailed error information: AgoraLocalVideoStreamError.
  sourceType | source type of the orignated video source. See AgoraVideoSourceType.

## ◆ 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

  engine | AgoraRtcEngineKit object.
  uid | ID of the user whose video state has changed.
  state | The remote video state: #AgoraVideoRemoteState.
  reason | The reason of the remote video state change: AgoraVideoRemoteReason.
  elapsed | The 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

  engine | The AgoraRtcEngineKit object.
  uid | The ID of the user whose audio state has changed.
  state | The state of the remote audio. See AgoraAudioRemoteState.
  reason | The reason of the remote audio state change. See AgoraAudioRemoteReason.
  elapsed | The 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

  engine | AgoraRtcEngineKit object.
  state | The state code in [AgoraChannelMediaRelayState](AgoraChannelMediaRelayState).
  error | The error code in [AgoraChannelMediaRelayError](AgoraChannelMediaRelayError).

## ◆ rtcEngine:didReceiveChannelMediaRelayEvent:

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

Reports events during the media stream relay.

Deprecated:
  v4.2.0. This callback is not recommended and will be removed in future releases.

Parameters

  engine | AgoraRtcEngineKit object.
  event | The event code in [AgoraChannelMediaRelayEvent](AgoraChannelMediaRelayEvent).

## ◆ rtcEngine:didProxyConnected:withUid:proxyType:localProxyIp:elapsed:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
didProxyConnected: |  | (NSString *_Nonnull) | channel
withUid: |  | (NSUInteger) | uid
proxyType: |  | (AgoraProxyType) | proxyType
localProxyIp: |  | (NSString *_Nonnull) | localProxyIp
elapsed: |  | (NSInteger) | elapsed

Occurs when join success after calling [setLocalAccessPoint]([AgoraRtcEngineKit setLocalAccessPoint:channelId:info:uid:joinSuccess:]) or [setCloudProxy]([AgoraRtcEngineKit setCloudProxy:proxyType])

Parameters

  engine | AgoraRtcEngineKit object.
  channel | Channel name.
  uid | User ID. If the `uid` is specified in the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method, the specified user ID is returned. If the user ID is not specified when the joinChannel method is called, the server automatically assigns a `uid`.
  proxyType | type of proxy agora sdk connected, proxyType will be AgoraNoneProxyType if not connected to proxy(fallback).
  localProxyIp | local proxy ip list, if not join local proxy, it will be ""
  elapsed | Time elapsed (ms) from the user calling the [joinChannelByToken]([AgoraRtcEngineKit joinChannelByToken:channelId:info:uid:joinSuccess:]) method until the SDK triggers this callback.

## ◆ rtcEngine:remoteUserStateChangedOfUid:state:

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

Occurs when the remote user state is updated.

Parameters

  engine | The AgoraRtcEngineKit object.
  uid | Remote user ID.
  state | The 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

  engine | The AgoraRtcEngineKit object.
  stats | The 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

  engine | The AgoraRtcEngineKit object.
  channelId | The channel name of user joined.
  uid | The remote user ID that is subscribed to.
  oldState | The old state of the video stream subscribe : AgoraStreamSubscribeState.
  newState | The new state of the video stream subscribe : AgoraStreamSubscribeState.
  elapseSinceLastState | The time elapsed (ms) from the old state to the new state.

## ◆ rtcEngine:didVideoPublishStateChange:sourceType:oldState:newState:elapseSinceLastState:

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

Occurs when the video publish state changed.

Parameters

  engine | The AgoraRtcEngineKit object.
  channelId | The channel name of user joined.
  sourceType | source type of the orignated video source. See AgoraVideoSourceType.
  oldState | The old state of the video stream publish : AgoraStreamPublishState.
  newState | The new state of the video stream publish : AgoraStreamPublishState.
  elapseSinceLastState | The 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

  engine | AgoraRtcEngineKit object.
  url | The CDN streaming URL.
  state | The RTMP or RTMPS streaming state: AgoraRtmpStreamingState.
  errCode | The 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

  engine | AgoraRtcEngineKit object.
  url | The RTMP or RTMPS streaming URL.
  eventCode | The event code. See AgoraRtmpStreamingEvent.

## ◆ rtcEngine:audioMixingStateChanged:reasonCode:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
audioMixingStateChanged: |  | (AgoraAudioMixingStateType) | state
reasonCode: |  | (AgoraAudioMixingReasonCode) | reasonCode

Audio mixing state changed.

Parameters

  engine | The AgoraRtcEngineKit object.
  state | AgoraAudioMixingStateType
  reasonCode | AgoraAudioMixingReasonCode

## ◆ rtcEngine:audioMixingPositionChanged:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
audioMixingPositionChanged: |  | (NSInteger) | position

Reports current AudioMixing progress.

The callback occurs once every one second during the playback and reports the current playback progress.

Parameters

  position | Current AudioMixing progress (millisecond).

## ◆ 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

  engine | AgoraRtcEngineKit object.
  width | The width (px) of the local video.
  height | The height (px) of the local video.
  faces | An 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.

## ◆ rtcEngine:localVideoStateChangedOfState:error:

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

## ◆ rtcEngine:didVideoPublishStateChange:oldState:newState:elapseSinceLastState:

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

## ◆ rtcEngine:firstLocalVideoFramePublishedWithElapsed:

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