Agora Objective-C API Reference for iOS/macOS

AgoraRtcEngineDelegate Category Reference

Conforms to NSObject
Declared in AgoraRtcEngineKit.h

Overview

The AgoraRtcEngineDelegate protocol enables callbacks to your app.

The SDK uses delegate callbacks in the AgoraRtcEngineDelegate protocol to report runtime events to the app. 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.

Core Delegate Methods

– rtcEngine:didOccurWarning:

Reports a warning during SDK runtime.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didOccurWarning:(AgoraWarningCode)warningCode

Parameters

engine

AgoraRtcEngineKit object

warningCode

Warning code: AgoraWarningCode

Discussion

In most cases, the app can ignore the warning reported by the SDK because the SDK can usually fix the issue and resume running.

For instance, the SDK may report an AgoraWarningCodeOpenChannelTimeout(106) warning upon disconnection from the server and attempts to reconnect.

See AgoraWarningCode.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didOccurError:

Reports an error during SDK runtime.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didOccurError:(AgoraErrorCode)errorCode

Parameters

engine

AgoraRtcEngineKit object

errorCode

Error code: AgoraErrorCode

Discussion

In most cases, the SDK cannot fix the issue and resume running. The SDK requires the app to take action or informs the user about the issue.

For example, the SDK reports an AgoraErrorCodeStartCall = 1002 error when failing to initialize a call. The app informs the user that the call initialization failed and invokes the leaveChannel method to leave the channel.

See AgoraErrorCode.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didApiCallExecute:api:result:

Occurs when a method is executed by the SDK.

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

Parameters

engine

AgoraRtcEngineKit object.

error

The error code (AgoraErrorCode) returned by the SDK when the method call fails. If the SDK returns 0, then the method call succeeds.

api

The method executed by the SDK.

result

The result of the method call.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didJoinChannel:withUid:elapsed:

Occurs when the local user joins a specified channel.

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

Parameters

engine

AgoraRtcEngineKit object.

channel

Channel name.

uid

User ID. If the uid is specified in the joinChannelByToken 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.

elapsed

Time elapsed (ms) from the user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

Same as joinSuccessBlock in the joinChannelByToken method.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didRejoinChannel:withUid:elapsed:

Occurs when the local user rejoins a channel.

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

Parameters

engine

AgoraRtcEngineKit object.

channel

Channel name.

uid

User ID. If the uid is specified in the joinChannelByToken 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.

elapsed

Time elapsed (ms) from starting to reconnect to a successful reconnection.

Discussion

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.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didLeaveChannelWithStats:

Occurs when the local user leaves a channel.

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

Parameters

engine

AgoraRtcEngineKit object.

stats

Statistics of the call: AgoraChannelStats.

Discussion

When the app calls the leaveChannel method, this callback notifies the app that a user leaves a channel.

With this callback, the app retrieves information, such as the call duration and the statistics of the received/transmitted data reported by the audioQualityOfUid callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didRegisteredLocalUser:withUid:

Occurs when the local user successfully registers a user account by calling the registerLocalUserAccount or joinChannelByUserAccount method.

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

Parameters

engine

AgoraRtcEngineKit object.

userAccount

The user account of the local user.

uid

The ID of the local user.

Discussion

This callback reports the user ID and user account of the local user.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didUpdatedUserInfo:withUid:

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

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

Parameters

engine

AgoraRtcEngineKit object.

userInfo

The AgoraUserInfo object that contains the user ID and user account of the remote user.

uid

The ID of the remote user.

Discussion

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

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didClientRoleChanged:newRole:

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

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

Parameters

engine

AgoraRtcEngineKit object.

oldRole

Role that the user switches from: AgoraClientRole.

newRole

Role that the user switches to: AgoraClientRole.

Discussion

The SDK triggers this callback when the local user switches the user role by calling the setClientRole method after joining the channel.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didJoinedOfUid:elapsed:

Occurs when a remote user or host joins a channel. Same as userJoinedBlock.

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

Parameters

engine

AgoraRtcEngineKit object.

uid

ID of the user or host who joins the channel. If the uid is specified in the joinChannelByToken method, the specified user ID is returned. If the uid is not specified in the joinChannelByToken method, the Agora server automatically assigns a uid.

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken or setClientRole method until the SDK triggers this callback.

Discussion

  • Communication profile: This callback notifies the app that another user joins the channel. If other users are already in the channel, the SDK also reports to the app on the existing users.
  • Live-broadcast profile: This callback notifies the app that a host joins the channel. If other hosts are already in the channel, the SDK also reports to the app on the existing hosts. Agora recommends limiting the number of hosts to 17.

The SDK triggers this callback under one of the following circumstances: - A remote user/host joins the channel by calling the joinChannelByToken method. - A remote user switches the user role to the host by calling the setClientRole method after joining the channel. - A remote user/host rejoins the channel after a network interruption. - A host injects an online media stream into the channel by calling the addInjectStreamUrl method.

Note:

Live-broadcast profile:

  • The host receives this callback when another host joins the channel.
  • The audience in the channel receives this callback when a new host joins the channel.
  • When a web application joins the channel, the SDK triggers this callback as long as the web application publishes streams.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didOfflineOfUid:reason:

Occurs when a remote user (Communication)/host (Live Broadcast) leaves a channel. Same as userOfflineBlock.

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

Parameters

engine

AgoraRtcEngineKit object.

uid

ID of the user or host who leaves a channel or goes offline.

reason

Reason why the user goes offline, see AgoraUserOfflineReason.

Discussion

There are two reasons for users to be offline:

  • Leave a channel: When the user/host leaves a channel, the user/host sends a goodbye message. When the message is received, the SDK assumes that the user/host leaves a channel.
  • 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. Unreliable network connections may lead to false detections, so Agora recommends using a signaling system for more reliable offline detection.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:connectionChangedToState:reason:

Occurs when the network connection state changes.

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

Parameters

engine

AgoraRtcEngineKit object.

state

The current network connection state, see AgoraConnectionStateType.

reason

The reason of the connection state change, see AgoraConnectionChangedReason.

Discussion

The SDK triggers this callback to report on the current network connection state when it changes, and the reason of the change.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:networkTypeChangedToType:

Occurs when the local network type changes.

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

Parameters

engine

AgoraRtcEngineKit object.

type

The network type, see AgoraNetworkType.

Discussion

When the network connection is interrupted, this callback indicates whether the interruption is caused by a network type change or poor network conditions.

Declared In

AgoraRtcEngineKit.h

– rtcEngineConnectionDidLost:

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

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

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

This callback is different from rtcEngineConnectionDidInterrupted:

  • The SDK triggers the rtcEngineConnectionDidInterrupted callback when it loses connection with the server for more than four seconds after it successfully joins the channel.
  • The SDK triggers the rtcEngineConnectionDidLost callback when it loses connection with the server for more than 10 seconds, regardless of whether it joins the channel or not.

If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora’s edge server, the SDK stops rejoining the channel.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:tokenPrivilegeWillExpire:

Occurs when the token expires in 30 seconds.

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

Parameters

engine

AgoraRtcEngineKit object.

token

The token that expires in 30 seconds.

Discussion

The user becomes offline if the token used in the joinChannelByToken method expires. The SDK triggers this callback 30 seconds before the token expires to remind the app to get a new token. Upon receiving this callback, generate a new token on the server and call the renewToken method to pass the new token to the SDK.

Declared In

AgoraRtcEngineKit.h

– rtcEngineRequestToken:

Occurs when the token expires.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

After a token is specified by calling the joinChannelByToken method, if the SDK losses connection to the Agora server due to network issues, the token may expire after a certain period of time and a new token may be required to reconnect to the server.

Th SDK triggers this callback to notify the app to generate a new token. Call the renewToken method to renew the token.

Declared In

AgoraRtcEngineKit.h

Media Delegate Methods

– rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:

Reports which users are speaking, the speakers' volumes, and whether the local user is speaking.

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

Parameters

engine

AgoraRtcEngineKit object.

speakers

AgoraRtcAudioVolumeInfo array.

  • 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, and
    • vad, which reports the voice activity status of the local user.
  • In the remote speakers' 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, and
    • vad = 0. An empty speakers array in the callback indicates that no remote user is speaking at the moment.
totalVolume

Total volume after audio mixing. The value range is [0,255].

  • 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 speakers' callback, totalVolume is the sum of the voice volume and audio-mixing volume of all the remote speakers.

Discussion

Same as audioVolumeIndicationBlock.

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

By default, this callback is disabled. You can enable it by calling the enableAudioVolumeIndication method. 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. For more information, see the detailed parameter descriptions.

Note:

  • To enable the voice activity detection of the local user, ensure that you set report_vad(YES) in the enableAudioVolumeIndication method.
  • Calling the muteLocalAudioStream method affects the behavior of the SDK:
    • If the local user calls the muteLocalAudioStream method, the SDK stops triggering the local user’s callback immediately.
    • 20 seconds after a remote speaker calls the muteLocalAudioStream method, the remote speakers' callback excludes information of this user; 20 seconds after all remote users call the muteLocalAudioStream method, the SDK stops triggering the remote speakers' callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:activeSpeaker:

Reports which user is the loudest speaker over a period of time.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine activeSpeaker:(NSUInteger)speakerUid

Parameters

engine

AgoraRtcEngineKit object.

speakerUid

The user ID of the active speaker. A speakerUid of 0 represents the local user.

Discussion

This callback reports the speaker with the highest accumulative volume during a certain period. If the user enables the audio volume indication by calling the enableAudioVolumeIndication method, this callback returns the user ID of the active speaker whose voice is detected by the audio volume detection module of the SDK.

Note:

  • To receive this callback, you need to call the enableAudioVolumeIndication method.
  • This callback returns the user ID of the user with the highest voice volume during a period of time, instead of at the moment.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstLocalAudioFrame:

Occurs when the engine sends the first local audio frame.

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

Parameters

engine

AgoraRtcEngineKit object.

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstRemoteAudioFrameOfUid:elapsed:

Occurs when the engine receives the first audio frame from a specified remote user.

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

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user.

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

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. Possible reasons include:

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstRemoteAudioFrameDecodedOfUid:elapsed:

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

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

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.

Discussion

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 method to stop sending the local audio stream.
    • The remote user calls the disableAudio method to disable audio.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstLocalVideoFrameWithSize:elapsed:

Occurs when the engine sends the first local video frame.

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

Parameters

engine

AgoraRtcEngineKit object.

size

Size of the first local video frame (width and height).

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK calls this callback.

If the startPreview method is called before the joinChannelByToken method, then elapsed is the time elapsed from calling the startPreview method until the SDK triggers this callback.

Discussion

Same as firstLocalVideoFrameBlock.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstRemoteVideoFrameOfUid:size:elapsed:

Occurs when the first remote video frame is rendered.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the video stream.

size

Size of the video frame (width and height).

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

Same as firstRemoteVideoFrameBlock.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didAudioMuted:byUid:

Occurs when a remote user’s audio stream is muted/unmuted.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid

Parameters

engine

AgoraRtcEngineKit object.

muted

Whether the remote user’s audio stream is muted/unmuted:

  • YES: Muted.
  • NO: Unmuted.
uid

ID of the remote user.

Discussion

The SDK triggers this callback when the remote user stops or resumes sending the audio stream by calling the muteLocalAudioStream method.

Note: This callback is invalid when the number of the users or broadcasters in a channel exceeds 20.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didVideoMuted:byUid:

Occurs when a remote user’s video stream playback pauses/resumes.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid

Parameters

engine

AgoraRtcEngineKit object.

muted

A remote user’s video stream playback pauses/resumes:

  • YES: Pause.
  • NO: Resume.
uid

User ID of the remote user.

Discussion

You can also use the remoteVideoStateChangedOfUid callback with the following parameters:

  • AgoraVideoRemoteStateStopped(0) and AgoraVideoRemoteStateReasonRemoteMuted(5).
  • AgoraVideoRemoteStateDecoding(2) and AgoraVideoRemoteStateReasonRemoteUnmuted(6).

Same as userMuteVideoBlock.

The SDK triggers this callback when the remote user stops or resumes sending the video stream by calling the muteLocalVideoStream method.

Note:

This callback is invalid when the number of users or broadcasters in a channel exceeds 20.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:videoSizeChangedOfUid:size:rotation:

Occurs when the video size or rotation of a specific remote user changes.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user or local user (0) whose video size or rotation changes.

size

New video size.

rotation

New rotation of the video. The value ranges between 0 and 360.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:remoteVideoStateChangedOfUid:state:reason:elapsed:

Occurs when the remote video state changes.

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

Parameters

engine

AgoraRtcEngineKit object.

uid

ID of the remote user whose video state changes.

state

The state of the remote video. See AgoraVideoRemoteState.

reason

The reason of the remote video state change. See AgoraVideoRemoteStateReason.

elapsed

The time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:localVideoStateChange:error:

Occurs when the local video stream state changes.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localVideoStateChange:(AgoraLocalVideoStreamState)state error:(AgoraLocalVideoStreamError)error

Parameters

engine

AgoraRtcEngineKit object.

state

The local video state, see AgoraLocalVideoStreamState. When the state is AgoraLocalVideoStreamStateFailed(3), see the error parameter for details.

error

The detailed error information of the local video, see AgoraLocalVideoStreamError.

Discussion

The SDK reports the current video state in this callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:remoteAudioStateChangedOfUid:state:reason:elapsed:

Occurs when the local audio state changes.

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

Parameters

engine

See AgoraRtcEngineKit.

uid

ID of the remote user whose audio state changes.

state

State of the remote audio. See AgoraAudioRemoteState.

reason

The reason of the remote audio state change. See AgoraAudioRemoteStateReason.

elapsed

Time elapsed (ms) from the local user calling the joinChannel method until the SDK triggers this callback.

Discussion

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.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:localAudioStateChange:error:

Occurs when the local audio state changes.

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

Parameters

engine

See AgoraRtcEngineKit.

state

The state of the local audio. See AgoraAudioLocalState.

error

The error information of the local audio. See AgoraAudioLocalError.

Discussion

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.

Declared In

AgoraRtcEngineKit.h

Fallback Delegate Methods

– rtcEngine:didLocalPublishFallbackToAudioOnly:

Occurs when the published video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video when the network conditions improve.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLocalPublishFallbackToAudioOnly:(BOOL)isFallbackOrRecover

Parameters

engine

AgoraRtcEngineKit object.

isFallbackOrRecover

Whether the published stream falls back to audio-only or switches back to the video:

  • YES: The published stream falls back to audio-only due to unreliable network conditions.
  • NO: The published stream switches back to the video after the network conditions improve.

Discussion

If you call the setLocalPublishFallbackOption method and set option as AgoraStreamFallbackOptionAudioOnly, the SDK triggers this callback when the published stream falls back to audio-only mode due to unreliable uplink conditions, or when the audio stream switches back to the video when the uplink network condition improves.

Note:

Once the published stream falls back to audio only, the remote app receives the userMuteVideoBlock callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didRemoteSubscribeFallbackToAudioOnly:byUid:

Occurs when the remote video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video after the network conditions improve.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSUInteger)uid

Parameters

engine

AgoraRtcEngineKit object.

isFallbackOrRecover

Whether the remote media stream falls back to audio-only or switches back to the video:

  • YES: The remote media stream falls back to audio-only due to unreliable network conditions.
  • NO: The remote media stream switches back to the video stream after the network conditions improve.
uid

ID of the remote user sending the stream.

Discussion

If you call setRemoteSubscribeFallbackOption and set option as AgoraStreamFallbackOptionAudioOnly, the SDK triggers this callback when the remote media stream falls back to audio only due to unreliable network conditions or switches back to the video after the network condition improves.

Note:

Once the remote media stream is switched to the low stream due to unreliable network conditions, you can monitor the stream switch between a high stream and low stream in the remoteVideoStats callback.

Declared In

AgoraRtcEngineKit.h

Device Delegate Methods

– rtcEngine:device:type:stateChanged:

Occurs when the device state changes. (macOS only.)

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine device:(NSString *_Nonnull)deviceId type:(AgoraMediaDeviceType)deviceType stateChanged:(NSInteger)state

Parameters

engine

AgoraRtcEngineKit object.

deviceId

Device ID.

deviceType

Device type: AgoraMediaDeviceType.

state

State of the device:

  • 0: Added.
  • 1: Removed.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didAudioRouteChanged:

Occurs when the local audio route changes.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing

Parameters

engine

AgoraRtcEngineKit object.

routing

Audio route: AgoraAudioOutputRouting.

Discussion

The SDK triggers this callback when the local audio route switches to an earpiece, speakerphone, headset, or Bluetooth device.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:cameraFocusDidChangedToRect:

Occurs when a camera focus area changes. (iOS only.)

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

Parameters

engine

AgoraRtcEngineKit object.

rect

Rectangular area in the camera zoom specifying the focus area.

Discussion

The SDK triggers this callback when the local user changes the camera focus position by calling the setCameraFocusPositionInPreview method.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:cameraExposureDidChangedToRect:

Occurs when the camera exposure area changes. (iOS only)

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

Parameters

engine

AgoraRtcEngineKit object.

rect

Rectangular area in the camera zoom specifying the exposure area.

Discussion

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

Declared In

AgoraRtcEngineKit.h

Statistics Delegate Methods

– rtcEngine:reportRtcStats:

Reports the statistics of the current call session once every two seconds.

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

Parameters

engine

AgoraRtcEngineKit object.

stats

RTC engine statistics: AgoraChannelStats.

Discussion

Same as rtcStatsBlock.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:lastmileQuality:

Reports the last mile network quality of the local user once every two seconds before the user joins a channel.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality

Parameters

engine

AgoraRtcEngineKit object.

quality

The last mile network quality based on the uplink and dowlink packet loss rate and jitter. See AgoraNetworkQuality.

Discussion

Last mile refers to the connection between the local device and Agora’s edge server. After the app calls the enableLastmileTest method, the SDK triggers this callback once every two seconds to report the uplink and downlink last mile network conditions of the local user before the user joins the channel.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:networkQuality:txQuality:rxQuality:

Reports the last mile network quality of each user in the channel once every two seconds.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine networkQuality:(NSUInteger)uid txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID. The network quality of the user with this uid is reported. If uid is 0, the local network quality is reported.

txQuality

Uplink transmission quality of the user in terms of the transmission bitrate, packet loss rate, average RTT (Round-Trip Time), and jitter of the uplink network. txQuality is a quality rating helping you understand how well the current uplink network conditions can support the selected AgoraVideoEncoderConfiguration. For example, a 1000-Kbps uplink network may be adequate for video frames with a resolution of 640 × 480 and a frame rate of 15 fps in the Live-broadcast profile, but may be inadequate for resolutions higher than 1280 × 720. See AgoraNetworkQuality.

rxQuality

Downlink network quality rating of the user in terms of packet loss rate, average RTT, and jitter of the downlink network. See AgoraNetworkQuality.

Discussion

Last mile refers to the connection between the local device and Agora’s edge server. The SDK triggers this callback once every two seconds to report the last mile network conditions of each user in the channel. If a channel includes multiple users, the SDK triggers this callback as many times.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:lastmileProbeTestResult:

Reports the last-mile network probe result.

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

Parameters

engine

AgoraRtcEngineKit object.

result

The uplink and downlink last-mile network probe test result, see AgoraLastmileProbeResult.

Discussion

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

Declared In

AgoraRtcEngineKit.h

– rtcEngine:localVideoStats:

Reports the statistics of the uploading local video streams once every two seconds. Same as localVideoStatBlock.

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

Parameters

engine

AgoraRtcEngineKit object.

stats

Statistics of the uploading local video streams. See AgoraRtcLocalVideoStats.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:localAudioStats:

Reports the statistics of the local audio stream.

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

Parameters

engine

See AgoraRtcEngineKit.

stats

The statistics of the local audio stream. See AgoraRtcLocalAudioStats.

Discussion

The SDK triggers this callback once every two seconds.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:remoteVideoStats:

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

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

Parameters

engine

AgoraRtcEngineKit object.

stats

Statistics of the received remote video streams. See AgoraRtcRemoteVideoStats.

Discussion

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

This callback reports the statistics more closely linked to the real-user experience of the video transmission quality than the statistics that the videoTransportStatsOfUid callback reports. This callback reports more about media layer statistics such as the frame loss rate, while the videoTransportStatsOfUid callback reports more about the transport layer statistics such as the packet loss rate.

Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall video quality acceptable even when the packet loss rate is high.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:remoteAudioStats:

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

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

Parameters

engine

AgoraRtcEngineKit object.

stats

Statistics of the received remote audio streams. See AgoraRtcRemoteAudioStats.

Discussion

This callback replaces the audioQualityOfUid callback.

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

This callback reports the statistics more closely linked to the real-user experience of the audio transmission quality than the statistics that the audioTransportStatsOfUid callback reports. This callback reports more about media layer statistics such as the frame loss rate, while the audioTransportStatsOfUid callback reports more about the transport layer statistics such as the packet loss rate.

Schemes such as FEC (Forward Error Correction) or retransmission counter the frame loss rate. Hence, users may find the overall audio quality acceptable even when the packet loss rate is high.

Declared In

AgoraRtcEngineKit.h

Audio Player Delegate Methods

– rtcEngineLocalAudioMixingDidFinish:

Occurs when the audio mixing file playback finishes.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

You can start an audio mixing file playback by calling the startAudioMixing method. The SDK triggers this callback when the audio mixing file playback finishes.

If the startAudioMixing method call fails, a warning code, AgoraWarningCodeAudioMixingOpenError, returns in the didOccurWarning callback.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:localAudioMixingStateDidChanged:errorCode:

Occurs when the state of the local user’s audio mixing file changes.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localAudioMixingStateDidChanged:(AgoraAudioMixingStateCode)state errorCode:(AgoraAudioMixingErrorCode)errorCode

Parameters

engine

AgoraRtcEngineKit object.

state

The state code, see AgoraAudioMixingStateCode.

errorCode

The error code, see AgoraAudioMixingErrorCode.

Discussion

  • When the audio mixing file plays, pauses playing, or stops playing, this callback returns 710, 711, or 713 in state, and 0 in errorCode.
  • When exceptions occur during playback, this callback returns 714 in state and an error in errorCode.
  • If the local audio mixing file does not exist, or if the SDK does not support the file format or cannot access the music file URL, the SDK returns AgoraWarningCodeAudioMixingOpenError = 701.

Declared In

AgoraRtcEngineKit.h

– rtcEngineRemoteAudioMixingDidStart:

Occurs when a remote user starts audio mixing.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

The SDK triggers this callback when a remote user calls the startAudioMixing method.

Declared In

AgoraRtcEngineKit.h

– rtcEngineRemoteAudioMixingDidFinish:

Occurs when a remote user finishes audio mixing.

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

Parameters

engine

AgoraRtcEngineKit object.

Declared In

AgoraRtcEngineKit.h

– rtcEngineDidAudioEffectFinish:soundId:

Occurs when the local audio effect playback finishes.

- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit *_Nonnull)engine soundId:(NSInteger)soundId

Parameters

engine

AgoraRtcEngineKit object.

soundId

ID of the local audio effect. Each local audio effect has a unique ID.

Discussion

You can start a local audio effect playback by calling the playEffect method. The SDK triggers this callback when the local audio effect file playback finishes.

Declared In

AgoraRtcEngineKit.h

CDN Live Streaming Delegate Methods

– rtcEngine:rtmpStreamingChangedToState:state:errorCode:

Occurs when the state of the RTMP streaming changes.

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

Parameters

engine

AgoraRtcEngineKit object.

url

The RTMP URL address.

state

The RTMP streaming state: AgoraRtmpStreamingState. When the streaming state is AgoraRtmpStreamingStateFailure(4), see the errorCode parameter for details.

errorCode

The detailed error information for streaming: AgoraRtmpStreamingErrorCode.

Discussion

The SDK triggers this callback to report the result of the local user calling the addPublishStreamUrl or removePublishStreamUrl method.

This callback returns the URL and its current streaming state.

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

Declared In

AgoraRtcEngineKit.h

– rtcEngine:streamPublishedWithUrl:errorCode:

Reports the result of calling the addPublishStreamUrl method.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamPublishedWithUrl:(NSString *_Nonnull)url errorCode:(AgoraErrorCode)errorCode

Parameters

engine

AgoraRtcEngineKit object.

url

The RTMP URL address.

errorCode

Error code: AgoraErrorCode. Main errors include:

  • AgoraErrorCodeNoError(0): The publishing succeeds.
  • AgoraErrorCodeFailed(1): The publishing fails.
  • AgoraErrorCodeInvalidArgument(2): Invalid argument used. If, for example, you do not call the setLiveTranscoding method to configure AgoraLiveTranscoding before calling the addPublishStreamUrl method, the SDK reports this error.
  • AgoraErrorCodeTimedOut(10): The publishing times out.
  • AgoraErrorCodeAlreadyInUse(19): The RTMP URL address is already in use for CDN live streaming.
  • AgoraErrorCodeAbort(20): The SDK disconnects from the CDN live streaming server, and the CDN live streaming stops.
  • AgoraErrorCodeResourceLimited(22): The backend system does not have enough resources for the CDN live streaming.
  • AgoraErrorCodeEncryptedStreamNotAllowedPublish(130): You cannot publish an encrypted stream.
  • AgoraErrorCodePublishStreamCDNError(151): CDN related errors. Remove the original URL address and add a new one by calling the removePublishStreamUrl and addPublishStreamUrl methods.
  • AgoraErrorCodePublishStreamNumReachLimit(152): The host publishes more than 10 URLs. Delete the unnecessary URLs before adding new ones.
  • AgoraErrorCodePublishStreamNotAuthorized(153): The host manipulates other hosts' URLs. Check your app logic.
  • AgoraErrorCodePublishStreamInternalServerError(154): An error occurs in Agora’s streaming server. Call the addPublishStreamUrl method to publish the streaming again.
  • AgoraErrorCodePublishStreamFormatNotSuppported(156): The format of the RTMP stream URL is not supported. Check whether the URL format is correct.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:streamUnpublishedWithUrl:

Reports the result of calling the removePublishStreamUrl method.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamUnpublishedWithUrl:(NSString *_Nonnull)url

Parameters

engine

AgoraRtcEngineKit object.

url

The RTMP URL address.

Discussion

This callback indicates whether you have successfully removed an RTMP stream from the CDN.

Declared In

AgoraRtcEngineKit.h

– rtcEngineTranscodingUpdated:

Occurs when the CDN live streaming settings are updated.

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

Parameters

engine

AgoraRtcEngineKit object.

Declared In

AgoraRtcEngineKit.h

Inject Online Stream Delegate Methods

– rtcEngine:streamInjectedStatusOfUrl:uid:status:

Reports the status of injecting an online stream to a live broadcast.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamInjectedStatusOfUrl:(NSString *_Nonnull)url uid:(NSUInteger)uid status:(AgoraInjectStreamStatus)status

Parameters

engine

AgoraRtcEngineKit object.

url

URL address of the externally injected stream.

uid

User ID.

status

Status of the externally injected stream. See AgoraInjectStreamStatus.

Declared In

AgoraRtcEngineKit.h

Stream Message Delegate Methods

– rtcEngine:receiveStreamMessageFromUid:streamId:data:

Occurs when the local user receives the data stream from a remote user within five seconds.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData *_Nonnull)data

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the message.

streamId

Stream ID.

data

Data received by the local user.

Discussion

The SDK triggers this callback when the local user receives the stream message that the remote user sends by calling the sendStreamMessage method.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didOccurStreamMessageErrorFromUid:streamId:error:missed:cached:

Occurs when the local user does not receive the data stream from the remote user within five seconds.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the message.

streamId

Stream ID.

error

Error code. See AgoraErrorCode.

missed

Number of lost messages.

cached

Number of incoming cached messages when the data stream is interrupted.

Discussion

The SDK triggers this callback when the local user fails to receive the stream message that the remote user sends by calling the sendStreamMessage method.

Declared In

AgoraRtcEngineKit.h

Miscellaneous Delegate Methods

– rtcEngineMediaEngineDidLoaded:

Occurs when the media engine loads.

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

Parameters

engine

AgoraRtcEngineKit object.

Declared In

AgoraRtcEngineKit.h

– rtcEngineMediaEngineDidStartCall:

Occurs when the media engine call starts.

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

Parameters

engine

AgoraRtcEngineKit object.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:channelMediaRelayStateDidChange:error:

Occurs when the state of the media stream relay changes.

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

Parameters

engine

AgoraRtcEngineKit object.

state

The state code in AgoraChannelMediaRelayState.

error

The error code in AgoraChannelMediaRelayError.

Discussion

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

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didReceiveChannelMediaRelayEvent:

Reports events during the media stream relay.

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

Parameters

engine

AgoraRtcEngineKit object.

event

The event code in AgoraChannelMediaRelayEvent.

Declared In

AgoraRtcEngineKit.h

Deprecated Delegates

– rtcEngine:audioTransportStatsOfUid:delay:lost:rxKBitRate:

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

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the audio packet.

delay

Network time delay (ms) from the remote user sending the audio packet to the local user.

lost

Packet loss rate (%) of the audio packet sent from the remote user.

rxKBitRate

Received bitrate (Kbps) of the audio packet sent from the remote user.

Discussion

DEPRECATED from v2.9.0. Use the remoteAudioStats callback instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives an audio packet from a remote user.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:videoTransportStatsOfUid:delay:lost:rxKBitRate:

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

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the video packet.

delay

Network time delay (ms) from the remote user sending the video packet to the local user.

lost

Packet loss rate (%) of the video packet sent from the remote user.

rxKBitRate

Received bitrate (Kbps) of the video packet sent from the remote user.

Discussion

DEPRECATED from v2.9.0. Use the remoteVideoStats callback instead.

This callback reports the transport layer statistics, such as the packet loss rate and network time delay, once every two seconds after the local user receives a video packet from a remote user.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didVideoEnabled:byUid:

Occurs when a specific remote user enables/disables the video module.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid

Parameters

engine

AgoraRtcEngineKit object.

enabled

Whether the remote user enables/disables the video module:

  • YES: Enable. The remote user can enter a video session.
  • NO: Disable. The remote user can only enter a voice session, and cannot send or receive any video stream.
uid

User ID of the remote user.

Discussion

DEPRECATED from v2.9.0. This callback is deprecated and replaced by the remoteVideoStateChangedOfUid callback with the following parameters:

  • AgoraVideoRemoteStateStopped(0) and AgoraVideoRemoteStateReasonRemoteMuted(5).
  • AgoraVideoRemoteStateDecoding(2) and AgoraVideoRemoteStateReasonRemoteUnmuted(6).

Once the video module is disabled, the remote user can only use a voice call. The remote user cannot send or receive any video from other users.

The SDK triggers this callback when the remote user enables or disables the video module by calling the enableVideo or disableVideo method.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didLocalVideoEnabled:byUid:

Occurs when a specific remote user enables/disables the local video capturing function.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid

Parameters

engine

AgoraRtcEngineKit object.

enabled

Whether the specific remote user enables/disables the local video capturing function:

  • YES: Enable. Other users in the channel can see the video of this remote user.
  • NO: Disable. Other users in the channel do not receive the video stream from this remote user, while this remote user can still receive the video streams from other users.
uid

User ID of the remote user.

Discussion

DEPRECATED from v2.9.0. This callback is deprecated and replaced by the remoteVideoStateChangedOfUid callback with the following parameters:

  • AgoraVideoRemoteStateStopped(0) and AgoraVideoRemoteStateReasonRemoteMuted(5).
  • AgoraVideoRemoteStateDecoding(2) and AgoraVideoRemoteStateReasonRemoteUnmuted(6).

This callback is only applicable to the scenario when the user only wants to watch the remote video without sending any video stream to the other user.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:firstRemoteVideoDecodedOfUid:size:elapsed:

Occurs when the first remote video frame is received and decoded.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the remote user sending the video stream.

size

Size of the video frame (width and height).

elapsed

Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.

Discussion

DEPRECATED from v2.9.0. Use AgoraVideoRemoteStateStarting(1) or AgoraVideoRemoteStateDecoding(2) in the remoteVideoStateChangedOfUid callback instead.

Same as firstRemoteVideoDecodedBlock.

This callback is triggered in either of the following scenarios:

  • The remote user joins the channel and sends the video stream.
  • The remote user stops sending the video stream and re-sends it after 15 seconds. Possible reasons include:

Declared In

AgoraRtcEngineKit.h

– rtcEngine:didMicrophoneEnabled:

Occurs when the microphone is enabled/disabled.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didMicrophoneEnabled:(BOOL)enabled

Parameters

engine

AgoraRtcEngineKit object.

enabled

Whether the microphone is enabled/disabled:

  • YES: Enabled.
  • NO: Disabled.

Discussion

DEPRECATED from v2.9.0. Use AgoraAudioLocalStateStopped(0) or AgoraAudioLocalStateRecording(1) in the localAudioStateChange callback instead.

The SDK triggers this callback when the local user resumes or stops capturing the local audio stream by calling the enableLocalAudio method.

Declared In

AgoraRtcEngineKit.h

– rtcEngineConnectionDidInterrupted:

Occurs when the connection between the SDK and the server is interrupted.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

DEPRECATED from v2.3.2. Use the connectionChangedToState callback instead.

The SDK triggers this callback when it loses connection with the server for more than four seconds after a connection is established.

After triggering this callback, the SDK tries reconnecting to the server. You can use this callback to implement pop-up reminders.

This callback is different from rtcEngineConnectionDidLost:

  • The SDK triggers the rtcEngineConnectionDidInterrupted callback when it loses connection with the server for more than four seconds after it joins the channel.
  • The SDK triggers the rtcEngineConnectionDidLost callback when it loses connection with the server for more than 10 seconds, regardless of whether it joins the channel or not.

If the SDK fails to rejoin the channel 20 minutes after being disconnected from Agora’s edge server, the SDK stops rejoining the channel.

Declared In

AgoraRtcEngineKit.h

– rtcEngineConnectionDidBanned:

Occurs when your connection is banned by the Agora server.

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

Parameters

engine

AgoraRtcEngineKit object

Discussion

DEPRECATED from v2.3.2. Use connectionChangedToState instead.

Declared In

AgoraRtcEngineKit.h

– rtcEngine:audioQualityOfUid:quality:delay:lost:

Reports the audio quality of the remote user.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioQualityOfUid:(NSUInteger)uid quality:(AgoraNetworkQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost

Parameters

engine

AgoraRtcEngineKit object.

uid

User ID of the speaker.

quality

Audio quality of the user, see AgoraNetworkQuality.

delay

Time delay (ms) of the audio packet sent from the sender to the receiver, including the time delay from audio sampling pre-processing, transmission, and the jitter buffer.

lost

Packet loss rate (%) of the audio packet sent from the sender to the receiver.

Discussion

Same as audioQualityBlock.

DEPRECATED from v2.3.2. Use remoteAudioStats instead.

The SDK triggers this callback once every two seconds. This callback reports the audio quality of each remote user/host sending an audio stream. If a channel has multiple users/hosts sending audio streams, then the SDK triggers this callback as many times.

See Also

Declared In

AgoraRtcEngineKit.h

– rtcEngineCameraDidReady:

Occurs when the camera turns on and is ready to capture video.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

DEPRECATED from v2.4.1. Use AgoraLocalVideoStreamStateCapturing(1) in the state parameter of localVideoStateChange instead.

Same as cameraReadyBlock.

Declared In

AgoraRtcEngineKit.h

– rtcEngineVideoDidStop:

Occurs when the video stops playing.

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

Parameters

engine

AgoraRtcEngineKit object.

Discussion

DEPRECATED from v2.4.1. Use AgoraLocalVideoStreamStateStopped(0) in the state parameter of localVideoStateChange instead

The app can use this callback to change the configuration of the view (for example, to display other screens in the view) after the video stops.

Declared In

AgoraRtcEngineKit.h

X
Is this page helpful?