Agora RTC Objective-C API Reference Refactor

<AgoraRtcEngineDelegate> Protocol Reference

Inherits <NSObject>.

## Delegate Methods
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.
(void) | - rtcEngineRequestToken:
(void) | - rtcEngine:tokenPrivilegeWillExpire:
(void) | - rtcEngine:renewTokenResult:code:
(void) | - rtcEngine:licenseValidationFailure:
(void) | - rtcEngineConnectionDidLost:
(void) | - rtcEngine:networkTypeChanged:
(void) | - rtcEngine:permissionError:
(void) | - rtcEngine:connectionChangedToState:reason:
(void) | - rtcEngine:reportRtcStats:
(void) | - rtcEngine:lastmileProbeTestResult:
(void) | - rtcEngine:uploadLogResultRequestId:success:reason:
(void) | - rtcEngine:didJoinChannel:withUid:elapsed:
(void) | - rtcEngine:didRejoinChannel:withUid:elapsed:
(void) | - rtcEngine:didClientRoleChanged:newRole:newRoleOptions:
(void) | - rtcEngine:didClientRoleChangeFailed:currentRole:
(void) | - rtcEngine:didLeaveChannelWithStats:
(void) | - rtcEngine:firstLocalAudioFramePublished:
(void) | - rtcEngine:localAudioStats:
(void) | - rtcEngine:localAudioStateChanged:reason:
(void) | - rtcEngine:cameraExposureDidChangedToRect:
(void) | - rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType:
(void) | - rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:
(void) | - rtcEngine:localVideoStats:sourceType:
(void) | - rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:
(void) | - rtcEngine:didJoinedOfUid:elapsed:
(void) | - rtcEngine:didOfflineOfUid:reason:
(void) | - rtcEngine:receiveRdtMessageFromUid:type:data:
(void) | - rtcEngine:receiveMediaControlMessageFromUid:data:

## Remote User Audio Delegate Methods
##
(void) | - rtcEngine:firstRemoteAudioFrameDecodedOfUid:elapsed:
(void) | - rtcEngine:remoteAudioStats:
(void) | - rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:
(void) | - rtcEngineIntraRequestReceived:
(void) | - rtcEngine:uplinkNetworkInfoUpdate:
(void) | - rtcEngine:didAudioSubscribeStateChange:uid:oldState:newState:elapseSinceLastState:
(void) | - rtcEngine:didAudioPublishStateChange:oldState:newState:elapseSinceLastState:
(void) | - rtcEngine:didLocalUserRegisteredWithUserId:userAccount:
(void) | - rtcEngine:didUserInfoUpdatedWithUserId:userInfo:
(void) | - rtcEngine:didRhythmPlayerStateChanged:reason:
(void) | - rtcEngine:didLocalVideoTranscoderErrorWithStream:errorCode:
(void) | - rtcEngine:videoSizeChangedOfSourceType:uid:size:rotation:
(void) | - rtcEngine:snapshotTaken:filePath:width:height:errCode:
(void) | - rtcEngine:localVideoStateChangedOfState:reason:sourceType:
(void) | - rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed:
(void) | - rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:
(void) | - rtcEngine:channelMediaRelayStateDidChange:error:
(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:reason:
(void) | - rtcEngine:rtmpStreamingEventWithUrl:eventCode:
(void) | - rtcEngine:audioMixingStateChanged:reasonCode:
(void) | - rtcEngine:audioMixingPositionChanged:
(void) | - rtcEngine:facePositionDidChangeWidth:previewHeight:faces:
(void) | - rtcEngine:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:
(void) | - rtcEngine:multiPathStats:

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

## Member Typedef Documentation

## ◆ AgoraLocalVideoStreamError

- (typedef NSUInteger) AgoraLocalVideoStreamError

## ◆ AgoraAudioLocalError

- (typedef NSUInteger) AgoraAudioLocalError

## ◆ AgoraRhythmPlayerError

- (typedef NSUInteger) AgoraRhythmPlayerError

## ◆ AgoraRtmpStreamingErrorCode

- (typedef NSUInteger) AgoraRtmpStreamingErrorCode

## Method Documentation

## ◆ rtcEngineRequestToken:

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

Occurs when the token expires.

The SDK triggers this callback if the token expires. When receiving this callback, you need to generate a new token on your token server and you can renew your token through one of the following ways:

- In scenarios involving one channel:
  - Call `renewToken:` to pass in the new token.
  - Call `leaveChannel:leaveChannelBlock:` to leave the current channel and then pass in the new token when you call `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` to join a channel.
- In scenarios involving mutiple channels: Call `updateChannelExWithMediaOptions:connection:` to pass in the new token.

Parameters

  engine | `AgoraRtcEngineKit` object.

## ◆ rtcEngine:tokenPrivilegeWillExpire:

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

Occurs when the token expires in 30 seconds.

When receiving this callback, you need to generate a new token on your token server and you can renew your token through one of the following ways:

- In scenarios involving one channel:
  - Call `renewToken:` to pass in the new token.
  - Call `leaveChannel:leaveChannelBlock:` to leave the current channel and then pass in the new token when you call `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` to join a channel.
- In scenarios involving mutiple channels: Call `updateChannelExWithMediaOptions:connection:` to pass in the new token. Call timing: The SDK triggers this callback 30 seconds before the token expires, reminding the app to update the token.

Parameters

  engine | `AgoraRtcEngineKit` object.
  token | The token that is about to expire.

## ◆ rtcEngine:renewTokenResult:code:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
renewTokenResult: |  | (NSString *_Nonnull) | token
code: |  | (AgoraRenewTokenErrorCode) | code

Callback for `renewToken:` call result.

Since
  v4.6.0

This callback is triggered after the user calls the `renewToken:` method to update the token, and is used to notify the app of the result.

Parameters

  token | Token.
  code | Error code. See AgoraRenewTokenErrorCode.

## ◆ 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 the `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` method, regardless of whether it is in the channel. If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora's edge server, the SDK stops rejoining the channel.

Parameters

  engine | `AgoraRtcEngineKit` object.

## ◆ rtcEngine:networkTypeChanged:

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

Occurs when the local network type changes.

This callback occurs when the connection state of the local user changes. You can get the connection state and reason for the state change in this callback. When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.

Parameters

  engine | `AgoraRtcEngineKit` object.
  type | The type of the local network connection. See `AgoraNetworkType`.

## ◆ rtcEngine:permissionError:

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

Occurs when the SDK cannot get the device permission.

When the SDK fails to get the device permission, the SDK triggers this callback to report which device permission cannot be got.

Parameters

  engine | `AgoraRtcEngineKit` object.
  type | The type of the device permission. See `AgoraPermissionType`.

## ◆ rtcEngine:connectionChangedToState:reason:

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

Occurs when the network connection state changes.

When the network connection state changes, the SDK triggers this callback and reports the current connection state and the reason for the change.

Parameters

  engine | `AgoraRtcEngineKit` object.
  state | The current connection state. See `AgoraConnectionState`.
  reason | The reason for a connection state change. See `AgoraConnectionChangedReason`.

## ◆ rtcEngine:reportRtcStats:

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

Reports the statistics about the current call.

Call timing: The SDK triggers this callback once every two seconds after the user joins the channel.

Parameters

  engine | `AgoraRtcEngineKit` object.
  stats | Statistics of the RTC engine. See `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 `startLastmileProbeTest:`.

Parameters

  engine | `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 a user joins the channel.

This callback notifies the application that a user joins a specified channel. Call timing: The SDK triggers this callback when you call `joinChannelByToken:channelId:info:uid:joinSuccess:`, `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:`, `joinChannelByToken:channelId:userAccount:joinSuccess:`, `joinChannelByToken:channelId:userAccount:mediaOptions:joinSuccess:`, `joinChannelExByToken:connection:delegate:mediaOptions:joinSuccess:` or `joinChannelExByToken:channelId:userAccount:delegate:mediaOptions:joinSuccess:` to join a channel.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channel | The channel name.
  uid | The ID of the user who rejoins the channel.
  elapsed | Time elapsed (ms) from the local user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until the SDK triggers this callback.

## ◆ rtcEngine:didRejoinChannel:withUid:elapsed:

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

Occurs when a user rejoins the channel.

Call timing: When a user loses connection with the server because of network problems, the SDK automatically tries to reconnect and triggers this callback upon reconnection.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channel | The channel name.
  uid | The ID of the user who rejoins the channel.
  elapsed | Time elapsed (ms) from the local user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until the SDK triggers this callback.

## ◆ rtcEngine:didClientRoleChanged:newRole:newRoleOptions:

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

Occurs when the user role or the audience latency level changes.

Call timing: This callback will be triggered in any of the following situations:

- Calling `setClientRole:` or `setClientRole:options:` to set the user role or audience latency level after joining a channel
- Calling `setClientRole:` or `setClientRole:options:` and set the user role to `AUDIENCE` before joining a channel.

Note
  This callback will not be triggered when you call `setClientRole:` or `setClientRole:options:` and set the user role to `BROADCASTER` before joining a channel.

Parameters

  engine | `AgoraRtcEngineKit` object.
  oldRole | Role that the user switches from: `AgoraClientRole`.
  newRole | Role that the user switches to: `AgoraClientRole`.
  newRoleOptions | Since v4.1.0 Properties of the role that the user switches to. See `AgoraClientRoleOptions`.

## ◆ rtcEngine:didClientRoleChangeFailed:currentRole:

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

Occurs when switching a user role fails.

This callback informs you about the reason for failing to switching and your current user role. Call timing: The SDK triggers this callback when the local user calls `setClientRole:` or `setClientRole:options:` after joining a channel to switch the user role but the switching fails.

Parameters

  reason | The reason for a user role switch failure. See `AgoraClientRoleChangeFailedReason`.
  currentRole | Current user role. See `AgoraClientRole`.

## ◆ rtcEngine:didLeaveChannelWithStats:

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

Occurs when a user leaves a channel.

You can obtain information such as the total duration of a call, and the data traffic that the SDK transmits and receives. Call timing: The SDK triggers this callback after you call `leaveChannel:`, `leaveChannel:leaveChannelBlock:`, `leaveChannelEx:leaveChannelBlock:`, or `leaveChannelEx:options:leaveChannelBlock:` to leave a channel.

Parameters

  engine | `AgoraRtcEngineKit` object.
  stats | Call statistics. See `AgoraChannelStats`.

## ◆ rtcEngine:firstLocalAudioFramePublished:

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

Occurs when the first audio frame is published.

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

- The local client enables the audio module and calls `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` successfully.
- The local client calls `muteLocalAudioStream:` (`YES`) and `muteLocalAudioStream:` (`NO`) in sequence.
- The local client calls `disableAudio` and `enableAudio` in sequence.
- The local client calls `pushExternalAudioFrameRawData:samples:sampleRate:channels:trackId:timestamp:` to successfully push the audio frame to the SDK.

Parameters

  engine | `AgoraRtcEngineKit` object.
  elapsed | Time elapsed (ms) from the local user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` 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 | `AgoraRtcEngineKit` object.
  stats | Local audio statistics. See `AgoraRtcLocalAudioStats`.

## ◆ rtcEngine:localAudioStateChanged:reason:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
localAudioStateChanged: |  | (AgoraAudioLocalState) | state
reason: |  | (AgoraAudioLocalReason) | reason

Occurs when the local audio stream state changes.

When the state of the local audio stream changes (including the state of the audio capture and encoding), the SDK triggers this callback to report the current state. This callback indicates the state of the local audio stream, and allows you to troubleshoot issues when audio exceptions occur.

Note
  When the state is `AgoraAudioLocalStateFailed` (3), you can view the error information in the `error` parameter.

Parameters

  engine | `AgoraRtcEngineKit` object.
  state | The state of the local audio. See `AgoraAudioLocalState`.
  reason | Reasons for local audio state changes. See `AgoraAudioLocalReason`.

## ◆ rtcEngine:cameraExposureDidChangedToRect:

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

Occurs when the camera exposure area changes.

The SDK triggers this callback when the local user changes the camera exposure position by calling `setCameraExposurePosition:`.

Parameters

  engine | `AgoraRtcEngineKit` object.
  rect | The focus rectangle in the local preview. See `CGRect`.

## ◆ rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType:

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

Occurs when the first video frame is published.

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

- The local client enables the video module and calls `joinChannelByToken:channelId:info:uid:joinSuccess:` or `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` to join the channel successfully.
- The local client calls `muteLocalVideoStream:` (`YES`) and `muteLocalVideoStream:` (`NO`) in sequence.
- The local client calls `disableVideo` and `enableVideo` in sequence.
- The local client calls `pushExternalVideoFrame:videoTrackId:` to successfully push the video frame to the SDK.

Parameters

  engine | `AgoraRtcEngineKit` object.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  elapsed | Time elapsed (ms) from the local user calling `joinChannelByToken:channelId:info:uid:joinSuccess:` or `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until this callback is triggered.

## ◆ rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:

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

Occurs when the first local video frame is displayed on the local video view.

The SDK triggers this callback when the first local video frame is displayed on the local video view.

Parameters

  engine | `AgoraRtcEngineKit` object.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  size | The size of the first local video frame.
  elapsed | The time elapsed (ms) from the local user calling `joinChannelByToken:channelId:info:uid:joinSuccess:` or `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` to join the channel to when the SDK triggers this callback. If `startPreview` / `startPreview:` is called before joining the channel, this parameter indicates the time elapsed from calling `startPreview` or `startPreview:` to when this event occurred.

## ◆ 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 to report the statistics of the local video stream.

Parameters

  engine | `AgoraRtcEngineKit` object.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  stats | The statistics of the local video stream. See `AgoraRtcLocalVideoStats`.

## ◆ rtcEngine:videoRenderingTracingResultOfUid:currentEvent:tracingInfo:

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

Video frame rendering event callback.

After calling the `startMediaRenderingTracing` method or joining a channel, the SDK triggers this callback to report the events of video frame rendering and the indicators during the rendering process. Developers can optimize the indicators to improve the efficiency of the first video frame rendering.

Parameters

  uid | The user ID.
  currentEvent | The current video frame rendering event. See `AgoraMediaTraceEvent`.
  tracingInfo | The indicators during the video frame rendering process. Developers need to reduce the value of indicators as much as possible in order to improve the efficiency of the first video frame rendering. See `AgoraVideoRenderingTracingInfo`.

## ◆ rtcEngine:didJoinedOfUid:elapsed:

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

Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) joins the channel.

- In a communication channel, this callback indicates that a remote user joins the channel. The SDK also triggers this callback to report the existing users in the channel when a user joins the channel.
- In a live-broadcast channel, this callback indicates that a host joins the channel. The SDK also triggers this callback to report the existing hosts in the channel when a host joins the channel. Agora recommends limiting the number of co-hosts to 32, with a maximum of 17 video hosts. Call timing: The SDK triggers this callback under one of the following circumstances:
- A remote user/host joins the channel.
- A remote user switches the user role to the host after joining the channel.
- A remote user/host rejoins the channel after a network interruption.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The ID of the user or host who joins the channel.
  elapsed | Time delay (ms) from the local user calling `joinChannelByToken:channelId:info:uid:joinSuccess:` or `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until this callback is triggered.

## ◆ rtcEngine:didOfflineOfUid:reason:

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

Occurs when a remote user (in the communication profile)/ host (in the live streaming profile) leaves the channel.

There are generally two reasons for users to become offline:

- Leave the channel: When a user/host leaves the channel, the user/host sends a goodbye message.
- Drop offline: When no data packet of the user or host is received for a certain period of time (20 seconds for the communication profile, and more for the live broadcast profile), the SDK assumes that the user/host drops offline. A poor network connection may lead to false detections. It is recommended to use the Agora RTM SDK for reliable offline detection. Call timing: This callback is triggered when a remote user (in the communication profile) or host (in the live streaming profile) leaves a channel.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The ID of the user who leaves the channel or goes offline.
  reason | Reasons why a remote user (in the communication profile) or host (in the live streaming profile) goes offline. See `AgoraUserOfflineReason`.

## ◆ rtcEngine:receiveRdtMessageFromUid:type:data:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
receiveRdtMessageFromUid: |  | (NSUInteger) | uid
type: |  | (AgoraRdtStreamType) | type
data: |  | (NSData *_Nonnull) | data

Occurs when the local user receives data via Reliable Data Transmission (RDT) from a remote user.

@technical preview

Parameters

  engine | The engine kit
  uid | The remote user id
  type | The stream type. See AgoraRdtStreamType.
  data | The data received.

## ◆ rtcEngine:receiveMediaControlMessageFromUid:data:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
receiveMediaControlMessageFromUid: |  | (NSUInteger) | uid
data: |  | (NSData *_Nonnull) | data

Occurs when the local user receives media control message sent by a remote user.

@technical preview

Parameters

  engine | The engine kit
  uid | The remote user id
  data | The data received.

## ◆ rtcEngine:firstRemoteAudioFrameDecodedOfUid:elapsed:

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

Occurs when the SDK receives the first audio frame from a specific remote user.

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

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The user ID of the remote user.
  elapsed | The time elapsed (ms) from the local user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until the SDK triggers this callback.

## ◆ rtcEngine:remoteAudioStats:

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

Reports the transport-layer statistics of each remote audio stream.

The SDK triggers this callback once every two seconds for each remote user who is sending audio streams. If a channel includes multiple remote users, the SDK triggers this callback as many times.

Parameters

  engine | `AgoraRtcEngineKit` object.
  stats | The statistics of the received remote audio streams. See `AgoraRtcRemoteAudioStats`.

## ◆ rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:

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

Reports the volume information of users.

By default, this callback is disabled. You can enable it by calling `enableAudioVolumeIndication:smooth:reportVad:`. Once this callback is enabled and users send streams in the channel, the SDK triggers the `rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:` callback according to the time interval set in `enableAudioVolumeIndication:smooth:reportVad:`. The SDK triggers two independent `rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:` callbacks simultaneously, which separately report the volume information of the local user who sends a stream and the remote users (up to three) whose instantaneous volume is the highest.

Note
  After receiving this callback, if you need to update the UI interface, ensure that the execution thread is switched to the UI thread. Once this callback is enabled, if the local user calls the `muteLocalAudioStream:` method to mute, the SDK continues to report the volume indication of the local user. If a remote user whose volume is one of the three highest in the channel stops publishing the audio stream for 20 seconds, the callback excludes this user's information; if all remote users stop publishing audio streams for 20 seconds, the SDK stops triggering the callback for remote users.

Parameters

  engine | `AgoraRtcEngineKit` object.
  speakers | The volume information of the users. See `AgoraRtcAudioVolumeInfo`. An empty `speakers` array in the callback indicates that no remote user is in the channel or is sending a stream.
  totalVolume | The volume of the speaker. The value range is [0,255]. In the callback for the local user, `totalVolume` is the volume of the local user who sends a stream. In the callback for remote users, `totalVolume` is the sum of the volume of all remote users (up to three) whose instantaneous volume is the highest. If the user calls `startAudioMixing:loopback:cycle:startPos:`, then `totalVolume` is the volume after audio mixing.

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

Occurs when the uplink network information changes.

The SDK triggers this callback when the uplink network information changes.

Note
  This callback only applies to scenarios where you push externally encoded video data in H.264 format to the SDK.

Parameters

  engine | `AgoraRtcEngineKit` object.
  networkInfo | The uplink network information. See `AgoraUplinkNetworkInfo`.

## ◆ 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 subscribing state changes.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channelId | The channel name.
  uid | The user ID of the remote user.
  oldState | The previous subscribing status. See `AgoraStreamSubscribeState`.
  newState | The current subscribing status. See `AgoraStreamSubscribeState`.
  elapseSinceLastState | The time elapsed (ms) from the previous state to the current 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 publishing state changes.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channelId | The channel name.
  oldState | The previous publishing state. See `AgoraStreamPublishState`.
  newState | The current publishing stat. See `AgoraStreamPublishState`.
  elapseSinceLastState | The time elapsed (ms) from the previous state to the current state.

## ◆ rtcEngine:didLocalUserRegisteredWithUserId:userAccount:

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

Occurs when the local user registers a user account.

After the local user successfully calls `registerLocalUserAccountWithAppID:userAccount:` to register the user account or calls `joinChannelByToken:channelId:userAccount:mediaOptions:joinSuccess:` to join a channel, the SDK triggers the callback and informs the local user's UID and User Account.

Parameters

  engine | `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, and triggers this callback on the local client.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The user ID of the remote user.
  userInfo | The UserInfo object that contains the user ID and user account of the remote user. See `AgoraUserInfo` for details.

## ◆ rtcEngine:didRhythmPlayerStateChanged:reason:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
didRhythmPlayerStateChanged: |  | (AgoraRhythmPlayerState) | state
reason: |  | (AgoraRhythmPlayerReason) | reason

Occurs when the state of virtual metronome changes.

When the state of the virtual metronome changes, the SDK triggers this callback to report the current state of the virtual metronome. This callback indicates the state of the local audio stream and enables you to troubleshoot issues when audio exceptions occur.

Parameters

  state | For the current virtual metronome status, see `AgoraRhythmPlayerState`.
  reason | For the error codes and error messages related to virtual metronome errors, see `AgoraRhythmPlayerReason`.

## ◆ rtcEngine:didLocalVideoTranscoderErrorWithStream:errorCode:

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

Occurs when there's an error during the local video mixing.

When you fail to call `startLocalVideoTranscoder:` or `updateLocalTranscoderConfiguration:`, the SDK triggers this callback to report the reason.

Parameters

  stream | The video streams that cannot be mixed during video mixing. See `AgoraTranscodingVideoStream`.
  errorCode | The reason for local video mixing error. See `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 video size or rotation of a specified user changes.

Parameters

  engine | `AgoraRtcEngineKit` object.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  uid | The ID of the user whose video size or rotation changes. (The `uid`for the local user is 0. The video is the local user's video preview).
  size | Video dimensions.
  rotation | The rotation information. The value range is [0,360). Attention: On iOS, The parameter value is always 0.

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

Reports the result of taking a video snapshot.

After a successful `takeSnapshot:filePath:` method call, the SDK triggers this callback to report whether the snapshot is successfully taken as well as the details for the snapshot taken.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The user ID. One `uid` of 0 indicates the local user.
  filePath | The local path of the snapshot.
  width | The width (px) of the snapshot.
  height | The height (px) of the snapshot.
  errCode | The message that confirms success or gives the reason why the snapshot is not successfully taken: 0: Success. < 0: Failure: -1: The SDK fails to write data to a file or encode a JPEG image. -2: The SDK does not find the video stream of the specified user within one second after the `takeSnapshot:filePath:` method call succeeds. The possible reasons are: local capture stops, remote end stops publishing, or video data processing is blocked. -3: Calling the `takeSnapshot:filePath:` method too frequently.

## ◆ rtcEngine:audioMetadataReceived:metadata:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
audioMetadataReceived: |  | (NSUInteger) | uid
metadata: |  | (NSData *_Nonnull) | metadata

## ◆ rtcEngine:localVideoStateChangedOfState:reason:sourceType:

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

Occurs when the local video stream state changes.

When the status of the local video changes, the SDK triggers this callback to report the current local video state and the reason for the state change. Applicable scenarios: You can use this callback to stay updated on the state changes of the local video stream, and take corresponding measures based on the reasons for the state changes, to better manage and debug issues related to the video stream. Call timing: - The SDK triggeres this callback under the following circumstances, with the `state` as AgoraVideoLocalStateFailed, and the `reason` as `AgoraLocalVideoStreamReasonCaptureFailure`:

- The app switches to the background, and the system revokes the camera resource.
- The camera starts normally, but does not output video frames for four consecutive seconds.

When the camera outputs captured video frames, if the SDK detects 15 consecutive duplicate video frames, it triggers this callback, with the `state` as `AgoraVideoLocalStateCapturing` and the `reason` as `AgoraLocalVideoStreamReasonCaptureFailure`.Note:

- Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.
- Normally, if there is an error in video capturing, the issue can be troubleshooted through the `reason` parameter in this callback. However, on some devices, when there is an issue with capturing (such as freezing), the Android system will not throw any error callbacks, so the SDK cannot report the reason for the change in local video status. In this case, you can determine if there is no video frame being captured by checking the following: this callback reports the `state` as `AgoraVideoLocalStateCapturing` or `AgoraVideoLocalStateEncoding`, and the `captureFrameRate` in the `rtcEngine:localVideoStats:sourceType:` callback is 0.

Note
  - Note that the video frame duplication detection is only available for video frames with a resolution greater than 200 × 200, a frame rate greater than or equal to 10 fps, and a bitrate less than 20 Kbps.
  - Normally, if there is an error in video capturing, the issue can be troubleshooted through the `reason` parameter in this callback. However, on some devices, when there is an issue with capturing (such as freezing), the Android system will not throw any error callbacks, so the SDK cannot report the reason for the change in local video status. In this case, you can determine if there is no video frame being captured by checking the following: this callback reports the `state` as `AgoraVideoLocalStateCapturing` or `AgoraVideoLocalStateEncoding`, and the `captureFrameRate` in the `rtcEngine:localVideoStats:sourceType:` callback is 0.

Parameters

  engine | `AgoraRtcEngineKit` object.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  state | The state of the local video, see `AgoraVideoLocalState`.
  reason | The reasons for changes in local video state. See `AgoraLocalVideoStreamReason`.

## ◆ 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 stream state changes.

Note
  This callback does not work properly when the number of users (in the communication profile) or hosts (in the live streaming channel) in a channel exceeds 32.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The ID of the remote user whose video state changes.
  state | The state of the remote video. See `AgoraVideoRemoteState`.
  reason | The reason for the remote video state change. See `AgoraVideoRemoteReason`.
  elapsed | Time elapsed (ms) from the local user calling the `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` method until the SDK triggers this callback.

## ◆ 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 remote audio state changes.

When the audio state of a remote user (in a voice/video call channel) or host (in a live streaming channel) changes, the SDK triggers this callback to report the current state of the remote audio stream.

Note
  This callback does not work properly when the number of users (in the communication profile) or hosts (in the live streaming channel) in a channel exceeds 32.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | The ID of the remote user whose audio state changes.
  state | The state of the remote audio. See `AgoraAudioRemoteState`.
  reason | The reason of the remote audio state change. See `AgoraAudioRemoteReason`.
  elapsed | Time elapsed (ms) from the local user calling the `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` method 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 returns the state of the current media relay with any error message.

Parameters

  engine | `AgoraRtcEngineKit` object.
  state | The state code. See `AgoraChannelMediaRelayState`.
  code | The error code of the channel media relay. See `AgoraChannelMediaRelayError`.

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

Reports the proxy connection state.

You can use this callback to listen for the state of the SDK connecting to a proxy. For example, when a user calls `setCloudProxy:` and joins a channel successfully, the SDK triggers this callback to report the user ID, the proxy type connected, and the time elapsed fromthe user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until this callback is triggered.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channel | The channel name.
  uid | The user ID.
  proxyType | The proxy type connected. See `AgoraProxyType`.
  localProxyIp | Reserved for future use.
  elapsed | The time elapsed (ms) from the user calling `joinChannelByToken:channelId:uid:mediaOptions:joinSuccess:` until this callback is triggered.

## ◆ 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 sent by each remote users.

Reports the statistics of the video stream from the remote users. The SDK triggers this callback once every two seconds for each remote user. If a channel has multiple users/hosts sending video streams, the SDK triggers this callback as many times.

Parameters

  engine | `AgoraRtcEngineKit` object.
  stats | Statistics of the remote video stream. 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 subscribing state changes.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channel | The channel name.
  uid | The user ID of the remote user.
  oldState | The previous subscribing status. See `AgoraStreamSubscribeState`.
  newState | The current subscribing status. See `AgoraStreamSubscribeState`.
  elapseSinceLastState | The time elapsed (ms) from the previous state to the current 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 publishing state changes.

Parameters

  engine | `AgoraRtcEngineKit` object.
  channelId | The channel name.
  sourceType | The type of the video source. See `AgoraVideoSourceType`.
  oldState | The previous publishing state. See `AgoraStreamPublishState`.
  newState | The current publishing stat. See `AgoraStreamPublishState`.
  elapseSinceLastState | The time elapsed (ms) from the previous state to the current state.

## ◆ rtcEngine:rtmpStreamingChangedToState:state:reason:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
rtmpStreamingChangedToState: |  | (NSString *_Nonnull) | url
state: |  | (AgoraRtmpStreamingState) | state
reason: |  | (AgoraRtmpStreamingReason) | reason

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.
  reason | The detailed error information for streaming: AgoraRtmpStreamingReason.

## ◆ rtcEngine:rtmpStreamingEventWithUrl:eventCode:

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

Reports events during the Media Push.

Since
  v3.1.0

Parameters

  engine | `AgoraRtcEngineKit` object.
  url | The URL for Media Push.
  eventCode | The event code of Media Push. See `AgoraRtmpStreamingEvent`.

## ◆ rtcEngine:audioMixingStateChanged:reasonCode:

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

Occurs when the playback state of the music file changes.

This callback occurs when the playback state of the music file changes, and reports the current state and error code.

Parameters

  engine | `AgoraRtcEngineKit` object.
  state | The playback state of the music file. See `AgoraAudioMixingStateType`.
  reasonCode | Error code. See `AgoraAudioMixingReasonCode`.

## ◆ rtcEngine:audioMixingPositionChanged:

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

Reports the playback progress of a music file.

After you called the `startAudioMixing:loopback:cycle:startPos:` method to play a music file, the SDK triggers this callback every two seconds to report the playback progress.

Parameters

  position | The playback progress (ms).

Returns
  - 0: Success.
  - < 0: Failure.

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

Since: v3.0.1. Once you enable face detection by calling `enableFaceDetection:` `(YES)`, 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 view.
- The distance between the human face and the screen. This value is based on the fitting calculation of the local video size and the position of the human face.

Note
  - When it is detected that the face in front of the camera disappears, the callback will be triggered immediately. When no human face is detected, the frequency of this callback to be triggered wil be decreased 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 video image captured by the local camera.
  height | The height (px) of the video image captured by the local camera.
  faces | Information of the detected face. See `AgoraFacePositionInfo`. The number of `AgoraFacePositionInfo` array reported in this callback is based on the faces detected. The length of the array can be 0, which means that no human face is detected in front of the camera.

## ◆ rtcEngine:didTranscodedStreamLayoutInfoUpdatedWithUserId:videoLayoutInfo:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
didTranscodedStreamLayoutInfoUpdatedWithUserId: |  | (NSUInteger) | uid
videoLayoutInfo: |  | (AgoraVideoLayoutInfo *_Nonnull) | videoLayoutInfo

Occurs when the local user receives a mixed video stream carrying layout information.

When the local user receives a mixed video stream sent by the video mixing server for the first time, or when there is a change in the layout information of the mixed stream, the SDK triggers this callback, reporting the layout information of each sub-video stream within the mixed video stream.

Parameters

  engine | `AgoraRtcEngineKit` object.
  uid | User ID who published this mixed video stream.
  videoLayoutInfo | Layout information of a specific sub-video stream within the mixed stream. See . `AgoraVideoLayoutInfo`

## ◆ rtcEngine:multiPathStats:

- (void) rtcEngine: |  | (AgoraRtcEngineKit *_Nonnull) | engine
multiPathStats: |  | (AgoraMultipathStats *_Nonnull) | stats

Report the multipath transmission statistics.

Postcondition
  This callback is triggered after you set `enableMultipath` to `true` to enable multipath transmission.

Since
  4.6.0

Parameters

  stats | The multipath statistics. See the MultipathStats structure for details.

## ◆ rtcEngine:rtmpStreamingChangedToState:state:errCode:

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

## ◆ rtcEngine:didRhythmPlayerStateChanged:errorCode:

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

## ◆ rtcEngine:localAudioStateChanged:error:

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

## ◆ rtcEngine:localVideoStateChangedOfState:error:

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

## ◆ rtcEngine:localVideoStateChangedOfState:error:sourceType:

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

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