AgoraRtcEngineDelegate

AgoraRtcEngineDelegateThe SDK uses the interface to send event notifications to your app. Your app can get those notifications through methods that inherit this interface.

All methods in this interface have default (empty) implementation. You can choose to inherit events related to your app scenario.

Attention:
  • In the callbacks, avoid implementing time-consuming tasks or calling APIs that may cause thread blocking (such as sendMessage). Otherwise, the SDK may not work properly.
  • The SDK no longer catches exceptions in the code logic that developers implement themselves in AgoraRtcEngineDelegate class. You need to handle this exception yourself, otherwise the app may crash when the exception occurs.

activeSpeaker

Occurs when the most active remote speaker is detected.

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

After a successful call of enableAudioVolumeIndication, the SDK continuously detects which remote user has the loudest volume. During the current period, the remote user whose volume is detected as the loudest for the most times, is the most active user.

When the number of users is no less than two and an active remote speaker exists, the SDK triggers this callback and reports the uid of the most active remote speaker.
  • If the most active remote speaker is always the same user, the SDK triggers the activeSpeaker callback only once.
  • If the most active remote speaker changes to another user, the SDK triggers this callback again and reports the uid of the new active remote speaker.

Parameters

engine
One AgoraRtcEngineKit object.
speakerUid
The user ID of the most active speaker.

rtcEngineDidAudioEffectFinish

Occurs when the playback of the local music file finishes.

- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit * _Nonnull)engine soundId:(int)soundId;

This callback occurs when the local audio effect file finishes playing.

Parameters

engine
One AgoraRtcEngineKit object.
soundId
The audio effect ID. The ID of each audio effect file is unique.

rtcEngineLocalAudioMixingDidFinish

Occurs when the playback of the local music file finishes.

- (void)rtcEngineLocalAudioMixingDidFinish:(AgoraRtcEngineKit * _Nonnull)engine;
Deprecated:
Please use audioMixingStateChanged instead.

After you call startAudioMixing [2/2] to play a local music file, this callback occurs when the playback finishes. If the call startAudioMixing [2/2] fails, the error code WARN_AUDIO_MIXING_OPEN_ERROR is returned.

Parameters

engine
One AgoraRtcEngineKit object.

audioMixingPositionChanged

Reports the playback progress of a music file.

- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioMixingPositionChanged:(NSInteger)position NS_SWIFT_NAME(rtcEngine(_:audioMixingPositionChanged:));

Details

Since
v4.2.0

After you called the startAudioMixing [2/2] 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.

audioMixingStateChanged

Occurs when the playback state of the music file changes.

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

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

Parameters

state
The playback state of the music file. See AgoraAudioMixingStateType.
reasonCode
Error code. See AgoraAudioMixingReasonCode.

didAudioPublishStateChange

Occurs when the audio publishing state changes.

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

Parameters

engine
One 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.

audioQualityOfUid

Reports the statistics of the audio stream sent by each remote user.

- (void)audioQualityBlock:(void (^_Nullable)(NSUInteger uid, AgoraNetworkQuality quality, NSUInteger delay, NSUInteger lost))audioQualityBlock
Deprecated:
Use remoteAudioStats instead.

The SDK triggers this callback once every two seconds to report the audio quality of each remote user who is sending an audio stream. If a channel has multiple users sending audio streams, the SDK triggers this callback as many times.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user sending the audio stream.
quality
Audio quality of the user. See AgoraNetworkQuality.
delay
The network delay (ms) from the sender to the receiver, including the delay caused by audio sampling pre-processing, network transmission, and network jitter buffering.
lost
The packet loss rate (%) of the audio packet sent from the remote user to the receiver.

didAudioRouteChanged

Occurs when the local audio route changes.

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

Parameters

engine
One AgoraRtcEngineKit object.
routing

The current audio routing. See AgoraAudioOutputRouting.

didAudioSubscribeStateChange

Occurs when the audio subscribing state changes.

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

Parameters

engine
One 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.

reportAudioVolumeIndicationOfSpeakers

Reports the volume information of users.

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

By default, this callback is disabled. You can enable it by calling enableAudioVolumeIndication. Once this callback is enabled and users send streams in the channel, the SDK triggers the reportAudioVolumeIndicationOfSpeakers callback according to the time interval set in enableAudioVolumeIndication. The SDK triggers two independent reportAudioVolumeIndicationOfSpeakers 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.

Attention:

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
One 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 [2/2], then totalVolume is the volume after audio mixing.

cameraExposureDidChangedToRect

Occurs when the camera exposure area changes.

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

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

Parameters

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

cameraFocusDidChangedToRect

Occurs when the camera focus area changes.

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

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

Parameters

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

rtcEngineCameraDidReady

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

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

Please use AgoraVideoLocalStateCapturing(1) in localVideoStateChangedOfState instead.

This callback indicates that the camera has been successfully turned on and you can start to capture video.

Parameters

engine
One AgoraRtcEngineKit object.

didReceiveChannelMediaRelayEvent

Reports events during the media stream relay.

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine
didReceiveChannelMediaRelayEvent:(AgoraChannelMediaRelayEvent)event;
Deprecated:
This callback is deprecated.

Parameters

engine
One AgoraRtcEngineKit object.
event

The event code of channel media relay. See AgoraChannelMediaRelayEvent.

channelMediaRelayStateDidChange

Occurs when the state of the media stream relay changes.

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

The SDK returns the state of the current media relay with any error message.

Parameters

engine
One AgoraRtcEngineKit object.
state

The state code. See AgoraChannelMediaRelayState.

code

The error code of the channel media relay. See AgoraChannelMediaRelayError.

didClientRoleChanged

Occurs when the user role switches during the interactive live streaming.

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

The SDK triggers this callback when the local user switches their user role by calling setClientRole [2/2] after joining the channel.

Parameters

engine
One 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.

didClientRoleChangeFailed

Occurs when the user role switching fails in the interactive live streaming.

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

In the live broadcasting channel profile, when the local user calls setClientRole [1/2] to switch the user role after joining the channel but the switch fails, the SDK triggers this callback to report the reason for the failure and the current user role.

Parameters

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

rtcEngineConnectionDidBanned

Occurs when the connection is banned by the Agora server.

- (void)rtcEngineConnectionDidBanned:(AgoraRtcEngineKit * _Nonnull)engine;
Deprecated:
Use connectionChangedToState instead.

Parameters

engine
One AgoraRtcEngineKit object.

rtcEngineConnectionDidInterrupted

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

- (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit * _Nonnull)engine;
Deprecated:
Use connectionChangedToState instead.
The SDK triggers this callback when it loses connection with the server for more than four seconds after the connection is established. After triggering this callback, the SDK tries to reconnect to the server. You can use this callback to implement pop-up reminders. The differences between this callback and rtcEngineConnectionDidLost are as follow:
  • 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, whether or not it joins 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
One AgoraRtcEngineKit object.

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;

The SDK triggers this callback when it cannot connect to the server 10 seconds after calling the joinChannelByToken [2/4] 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
One AgoraRtcEngineKit object.

connectionChangedToState

Occurs when the network connection state changes.

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

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
One AgoraRtcEngineKit object.
state

The current connection state. See AgoraConnectionState.

reason

The reason for a connection state change. See AgoraConnectionChangedReason.

didOccurEncryptionError

Reports the built-in encryption errors.

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine 
                    didOccurEncryptionError:(AgoraEncryptionErrorType)errorType;

When encryption is enabled by calling enableEncryption, the SDK triggers this callback if an error occurs in encryption or decryption on the sender or the receiver side.

Parameters

engine
One AgoraRtcEngineKit object.
errorType
Details about the error type. See AgoraEncryptionErrorType.

didOccurError

Reports an error during SDK runtime.

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

This callback indicates that an error (concerning network or media) occurs during SDK runtime. In most cases, the SDK cannot fix the issue and resume running. The SDK requires the application to take action or informs the user about the issue.

Parameters

engine
One AgoraRtcEngineKit object.
errorCode
Error code. See AgoraErrorCode.

facePositionDidChangeWidth

Reports the face detection result of the local user.

- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine facePositionDidChangeWidth:(int)width previewHeight:(int)height faces:(NSArray<AgoraFacePositionInfo*>* _Nullable)faces NS_SWIFT_NAME(rtcEngine(_:facePositionDidChangeWidth:previewHeight:faces:));
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.

Attention:
  • 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 rtriggered 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
One 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.

firstLocalAudioFramePublished

Occurs when the first audio frame is published.

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine firstLocalAudioFramePublished:(NSInteger)elapsed;
The SDK triggers this callback under one of the following circumstances:

Parameters

engine
One AgoraRtcEngineKit object.
elapsed
Time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

firstLocalVideoFramePublishedWithElapsed

Occurs when the first video frame is published.

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine
                 firstLocalVideoFramePublishedWithElapsed:(NSInteger)elapsed
                 sourceType:(AgoraVideoSourceType)sourceType;
The SDK triggers this callback under one of the following circumstances:
  • The local client enables the video module and calls joinChannelByToken [2/4] 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 to successfully push the video frame to the SDK.

Parameters

engine
One AgoraRtcEngineKit object.
sourceType
The type of the video source. See AgoraVideoSourceType.
elapsed
Time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

firstLocalVideoFrameWithSize

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

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

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

Parameters

engine
One AgoraRtcEngineKit object.
sourceType
The type of the video source. See AgoraVideoSourceType.
size
The size of the first local video frame.
elapsed
Time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback. If you call startPreview before calling joinChannelByToken [2/4], then this parameter is the time elapsed from calling the startPreview method until the SDK triggers this callback.

firstRemoteAudioFrameOfUid

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

- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed NS_SWIFT_NAME(rtcEngine(_:firstRemoteAudioFrameOfUid:elapsed:));
Deprecated:
Use remoteAudioStateChangedOfUid instead.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user.
elapsed
The time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

firstRemoteAudioFrameDecodedOfUid

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

- (void)rtcEngine:(AgoraRtcEngineKit* _Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed;
Deprecated:
Use remoteAudioStateChangedOfUid instead.
The SDK triggers this callback under one of the following circumstances:
  • The remote user joins the channel and sends the audio stream for the first time.
  • The remote user's audio is offline and then goes online to re-send audio. It means the local user cannot receive audio in 15 seconds. Reasons for such an interruption include:
    • The remote user leaves channel.
    • The remote user drops offline.
    • The remote user calls muteLocalAudioStream to stop sending the audio stream.
    • The remote user calls disableAudio to disable audio.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user.
elapsed
The time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

firstRemoteVideoDecodedOfUid

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;
The SDK triggers this callback under one of the following circumstances:
  • 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. Reasons for such an interruption include:
    • The remote user leaves the channel.
    • The remote user drops offline.
    • The remote user calls muteLocalVideoStream to stop sending the video stream.
    • The remote user calls disableVideo to disable video.

Parameters

uid
The user ID of the remote user sending the video stream.
engine
One AgoraRtcEngineKit object.
size
Video dimensions.
elapsed
The time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

firstRemoteVideoFrameOfUid

Occurs when the renderer receives the first frame of the remote video.

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

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user sending the video stream.
size
Video dimensions.
elapsed
The time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

didJoinChannel

Occurs when a user joins a channel.

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

This callback notifies the application that a user joins a specified channel.

Parameters

engine
One AgoraRtcEngineKit object.
channel
The channel name.
uid
The ID of the user who joins the channel.
elapsed
The time elapsed (ms) from the local user calling joinChannelByToken [2/4] until the SDK triggers this callback.

lastmileProbeTestResult

Reports the last mile network probe result.

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

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

Parameters

engine
One AgoraRtcEngineKit object.
result
The uplink and downlink last-mile network probe test result. See AgoraLastmileProbeResult.

lastmileQuality

Reports the last-mile network quality of the local user.

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

This callback reports the last-mile network conditions of the local user before the user joins the channel. Last mile refers to the connection between the local device and Agora's edge server.

Before the user joins the channel, this callback is triggered by the SDK oncestartLastmileProbeTest is called and reports the last-mile network conditions of the local user.

Parameters

engine
One AgoraRtcEngineKit object.
quality
The last-mile network quality. See AgoraNetworkQuality.

didLeaveChannelWithStats

Occurs when a user leaves a channel.

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

This callback notifies the app that the user leaves the channel by calling leaveChannel [1/2] . From this callback, the app can get information such as the call duration and quality statistics.

Parameters

engine
One AgoraRtcEngineKit object.
stats
The statistics of the call. See AgoraChannelStats.

localAudioStateChanged

Occurs when the local audio stream state changes.

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

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.

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

Parameters

engine
One AgoraRtcEngineKit object.
state
The state of the local audio. See AgoraAudioLocalState.
error
Local audio state error codes. See AgoraAudioLocalError.

localAudioStats

Reports the statistics of the local audio stream.

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

The SDK triggers this callback once every two seconds.

Parameters

engine
One AgoraRtcEngineKit object.
stats
Local audio statistics. See AgoraRtcLocalAudioStats.

didLocalUserRegisteredWithUserId

Occurs when the local user registers a user account.

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

After the local user successfully calls registerLocalUserAccountWithAppID to register the user account or calls joinChannelByToken [4/4] to join a channel, the SDK triggers the callback and informs the local user's UID and User Account.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the local user.
userAccount
The user account of the local user.

localVideoStateChangedOfState

Occurs when the local video stream state changes.

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

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

The SDK triggers the localVideoStateChangedOfState callback with the state code of AgoraVideoLocalStateFailed and error code of AgoraLocalVideoStreamErrorCaptureFailure in the following situations:
  • The app switches to the background, and the system gets the camera resource.
  • The camera starts normally, but does not output video frames for four consecutive seconds.

When the camera outputs the captured video frames, if the video frames are the same for 15 consecutive frames, the SDK triggers the localVideoStateChangedOfState callback with the state code of AgoraVideoLocalStateCapturing and error code of AgoraLocalVideoStreamErrorCaptureFailure. 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.

Attention: For some device models, the SDK does not trigger this callback when the state of the local video changes while the local video capturing device is in use, so you have to make your own timeout judgment.

Parameters

engine
One AgoraRtcEngineKit object.
sourceType
The type of the video source. See AgoraVideoSourceType.
state

The state of the local video, see AgoraVideoLocalState.

error

The detailed error information, see AgoraLocalVideoStreamError.

localVideoStats

Reports the statistics of the local video stream.

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

The SDK triggers this callback once every two seconds to report the statistics of the local video stream.

Parameters

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

didLocalVideoTranscoderErrorWithStream

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

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didLocalVideoTranscoderErrorWithStream:(AgoraTranscodingVideoStream * _Nonnull )stream
        errorCode:(AgoraVideoTranscoderError)errorCode NS_SWIFT_NAME(rtcEngine(_:didLocalVideoTranscoderErrorWithStream:errorCode:));

Details

Since
v4.2.0

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.

rtcEngineMediaEngineDidLoaded

Occurs when the media engine loads.

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

Parameters

engine
One AgoraRtcEngineKit object.

rtcEngineMediaEngineDidStartCall

Occurs when the media engine call starts.

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

Parameters

engine
One AgoraRtcEngineKit object.

networkQuality

Reports the last mile network quality of each user in the channel.

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

This callback reports the last mile network conditions of each user in the channel. Last mile refers to the connection between the local device and Agora's edge server.

The SDK triggers this callback once every two seconds. If a channel includes multiple users, the SDK triggers this callback as many times.

Note: txQuality is Unknown when the user is not sending a stream; rxQuality is Unknown when the user is not receiving a stream.

Parameters

engine
One AgoraRtcEngineKit object.
uid

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

txQuality
Uplink network quality rating of the user in terms of the transmission bit rate, packet loss rate, average RTT (Round-Trip Time) and jitter of the uplink network. This parameter is a quality rating helping you understand how well the current uplink network conditions can support the selected video encoder configuration. 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_BROADCASTING profile, but might 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.

networkTypeChangedToType

Occurs when the local network type changes.

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

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
One AgoraRtcEngineKit object.
type

The type of the local network connection. See AgoraNetworkType.

permissionError

Occurs when the SDK cannot get the device permission.

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

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

Parameters

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

didRejoinChannel

Occurs when a user rejoins the channel.

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

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
One 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 [2/4] until the SDK triggers this callback.

remoteAudioStateChangedOfUid

Occurs when the remote audio state changes.

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

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.

Attention: 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 17.

Parameters

engine
One 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 [2/4] method until the SDK triggers this callback.

remoteAudioStats

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

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

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
One AgoraRtcEngineKit object.
stats
The statistics of the received remote audio streams. See AgoraRtcRemoteAudioStats.

audioTransportStatsOfUid

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;
Deprecated:
Use remoteAudioStats instead.

This callback reports the transport-layer statistics, such as the packet loss rate and network time delay after the local user receives an audio packet from a remote user. During a call, when the user receives the audio packet sent by the remote user, the callback is triggered every 2 seconds.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the remote user sending the audio streams.
delay
The network delay (ms) from the remote user to the receiver.
lost
The packet loss rate (%) of the audio packet sent from the remote user to the receiver.
rxKBitrate
The bitrate of the received audio (Kbps).

remoteVideoStateChangedOfUid

Occurs when the remote video stream state changes.

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine
     remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed;
Attention: 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 17.

Parameters

engine
One 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 [2/4] method until the SDK triggers this callback.

remoteVideoStats

Reports the statistics of the video stream sent by each remote users.

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

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
One AgoraRtcEngineKit object.
stats
Statistics of the remote video stream. See AgoraRtcRemoteVideoStats.

videoTransportStatsOfUid

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;
Deprecated:
This callback is deprecated. Use remoteVideoStats instead.

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

During a call, when the user receives the video packet sent by the remote user/host, the callback is triggered every 2 seconds.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the remote user sending the video packets.
delay
The network delay (ms) from the sender to the receiver.
lost
The packet loss rate (%) of the video packet sent from the remote user.
rxKBitRate
The bitrate of the received video (Kbps).

rtcEngineRequestToken

Occurs when the token expires.

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

When the token expires during a call, the SDK triggers this callback to remind the app to renew the token.

Once you receive this callback, you need to generate a new token on your app server, and call joinChannelByToken [2/4] to rejoin the channel.

Parameters

engine
One AgoraRtcEngineKit object.

reportRtcStats

Reports the statistics of the current call.

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

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

Parameters

engine
One AgoraRtcEngineKit object.
stats

Statistics of the RTC engine. See AgoraChannelStats.

rtmpStreamingEventWithUrl

Reports events during the Media Push.

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

Parameters

url
The URL for Media Push.
eventCode
The event code of Media Push. See AgoraRtmpStreamingEvent.

rtmpStreamingChangedToState

Occurs when the state of Media Push changes.

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

When the state of Media Push changes, the SDK triggers this callback and reports the URL address and the current state of the Media Push. This callback indicates the state of the Media Push. When exceptions occur, you can troubleshoot issues by referring to the detailed error descriptions in the error code parameter.

Parameters

engine
One AgoraRtcEngineKit object.
url

The URL address where the state of the Media Push changes.

state
The current state of the Media Push. See AgoraRtmpStreamingState.
errCode
The detailed error information for the Media Push. See AgoraRtmpStreamingErrorCode.

snapshotTaken

Reports the result of taking a video snapshot.

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

After a successful takeSnapshot 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
One 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 method call succeeds. The possible reasons are: local capture stops, remote end stops publishing, or video data processing is blocked.
    • -3: Calling the takeSnapshot method too frequently.

receiveStreamMessageFromUid

Occurs when the local user receives the data stream from the remote user.

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

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

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the remote user sending the message.
streamId
The stream ID of the received message.
data
The data received.

didOccurStreamMessageErrorFromUid

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

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

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.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the remote user sending the message.
streamId
The stream ID of the received message.
error
The error code.
missed
The number of lost messages.
cached
Number of incoming cached messages when the data stream is interrupted.

tokenPrivilegeWillExpire

Occurs when the token expires in 30 seconds.

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

When the token is about to expire in 30 seconds, the SDK triggers this callback to remind the app to renew the token.

Upon receiving this callback, you need to generate a new token on your server, and call renewToken to pass the new token to the SDK.

Parameters

engine
One AgoraRtcEngineKit object.
token
The token that expires in 30 seconds.

rtcEngineTranscodingUpdated

Occurs when the publisher's transcoding is updated.

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

When the AgoraLiveTranscoding class in the setLiveTranscoding method updates, the SDK triggers the rtcEngineTranscodingUpdated callback to report the update information.

Attention: If you call the setLiveTranscoding method to set the AgoraLiveTranscoding class for the first time, the SDK does not trigger this callback.

Parameters

engine
One AgoraRtcEngineKit object.

uplinkNetworkInfoUpdate

Occurs when the uplink network information changes.

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

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

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

Parameters

engine
One AgoraRtcEngineKit object.
networkInfo
The uplink network information. See AgoraUplinkNetworkInfo.

didLocalVideoEnabled

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

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

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

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user.
enabled
Whether the specified remote user enables/disables the local video capturing function:
  • YES: The video module is enabled. Other users in the channel can see the video of this remote user.
  • NO: The video module is disabled. Other users in the channel can no longer receive the video stream from this remote user, while this remote user can still receive the video streams from other users.

didVideoEnabled

Occurs when a remote user enables or disables the video module.

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

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

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

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user.
enabled
  • YES: The video module is enabled.
  • NO: The video module is disabled.

didUserInfoUpdatedWithUserId

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

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

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

didJoinedOfUid

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

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine
    didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed;
  • 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 hosts to 17.
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
One AgoraRtcEngineKit object.
uid
The ID of the user or host who joins the channel.
elapsed
Time delay (ms) from the local user calling joinChannelByToken [2/4] until this callback is triggered.

didAudioMuted

Occurs when a remote user (in the communication profile) or a host (in the live streaming profile) stops/resumes sending the audio stream.

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

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

Attention: 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 17.

Parameters

uid
The user ID.
muted
Whether the remote user's audio stream is muted:
  • YES: User's audio stream is muted.
  • NO: User's audio stream is unmuted.

didVideoMuted

Occurs when a remote user stops or resumes publishing the video stream.

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

When a remote user calls muteLocalVideoStream to stop or resume publishing the video stream, the SDK triggers this callback to report to the local user the state of the streams published by the remote user.

Attention: This callback can be inaccurate when the number of users (in the communication profile) or hosts (in the live streaming profile) in a channel exceeds 17.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The user ID of the remote user.
muted
Whether the remote user stops publishing the video stream:
  • YES: The remote user stops publishing the video stream.
  • NO: The remote user resumes publishing the video stream.

didOfflineOfUid

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

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine
    didOfflineOfUid:(NSUInteger)uid
    reason:(AgoraUserOfflineReason)reason;
There are two reasons for users to become offline:
  • Leave the channel: When a user/host leaves the channel, the user/host sends a goodbye message. When this message is received, the SDK determines that the user/host leaves the 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. A poor network connection may lead to false detections. It's recommended to use the Agora RTM SDK for reliable offline detection.

Parameters

engine
One AgoraRtcEngineKit object.
uid
The ID of the user who leaves the channel or goes offline.
reason

Reasons why the user goes offline: AgoraUserOfflineReason.

didVideoPublishStateChange

Occurs when the video publishing state changes.

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

Parameters

engine
One 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.

didRhythmPlayerStateChanged

Occurs when the state of virtual metronome changes.

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

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.
errorCode
For the error codes and error messages related to virtual metronome errors, see AgoraRhythmPlayerError.

videoSizeChangedOfSourceType

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

- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSString * _Nonnull)uid size:(CGSize)size rotation:(NSInteger)rotation NS_SWIFT_NAME(rtcEngine(_:videoSizeChangedOf:uid:size:rotation:));

Parameters

engine
One 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).

rtcEngineVideoDidStop

Occurs when the video stops playing.

- (void)rtcEngineVideoDidStop:(AgoraRtcEngineKit * _Nonnull)engine;
Deprecated:
Use AgoraVideoLocalStateStopped(0) in the localVideoStateChangedOfState callback instead.

The application can use this callback to change the configuration of the view (for example, displaying other pictures in the view) after the video stops playing.

Parameters

engine
One AgoraRtcEngineKit object.

didVideoSubscribeStateChange

Occurs when the video subscribing state changes.

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

Parameters

engine
One AgoraRtcEngineKit object.
channel
The channel name.
uid
The ID of the remote user.
oldState
The previous subscribing status, see AgoraStreamSubscribeState for details.
newState
The current subscribing status, see AgoraStreamSubscribeState for details.
elapseSinceLastState
The time elapsed (ms) from the previous state to the current state.