Agora RTC Objective-C API Reference  Refactor
Instance Methods
<AgoraBaseDelegate> Protocol Reference

Inherits <NSObject>.

Inherited by <AgoraRtcEngineDelegate2>.

Instance Methods

(void) - rtcEngine:didLocalUserRegisteredWithUserId:userAccount:
 
(void) - rtcEngine:didUserInfoUpdatedWithUserId:userInfo:
 
(void) - rtcEngineRequestToken:
 
(void) - rtcEngineConnectionDidLost:
 
(void) - rtcEngine:reportRtcStats:
 
(void) - rtcEngine:lastmileProbeTestResult:
 
(void) - rtcEngine:didApiCallExecute:api:result:
 
(void) - rtcEngine:uploadLogResultRequestId:success:reason:
 
(void) - rtcEngine:didClientRoleChanged:newRole:newRoleOptions:
 
(void) - rtcEngine:didClientRoleChangeFailed:currentRole:
 
(void) - rtcEngine:didLeaveChannelWithStats:
 
(void) - rtcEngine:firstLocalAudioFramePublished:
 
(void) - rtcEngine:localAudioStats:
 
(void) - rtcEngine:audioMixingStateChanged:reasonCode:
 
(void) - rtcEngine:audioMixingPositionChanged:
 
(void) - rtcEngine:cameraExposureDidChangedToRect:
 
(void) - rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType:
 
(void) - rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:
 
(void) - rtcEngine:localVideoStats:sourceType:
 
(void) - rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:
 
(void) - rtcEngine:remoteAudioStats:
 
(void) - rtcEngine:remoteVideoStats:
 

Face Detection Delegate Methods


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

Method Documentation

◆ rtcEngine:didLocalUserRegisteredWithUserId:userAccount:

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

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

Parameters
uidThe ID of the local user.
userAccountThe user account of the local user.

◆ rtcEngine:didUserInfoUpdatedWithUserId:userInfo:

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

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

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

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

◆ rtcEngineRequestToken:

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

when token is enabled, and specified token is invalid or expired, this function will be called. APP should generate a new token and call renewToken() to refresh the token. NOTE: to be compatible with previous version, ERR_TOKEN_EXPIRED and ERR_INVALID_TOKEN are also reported via onError() callback. You should move renew of token logic into this callback.

Parameters
engineThe engine kit

◆ rtcEngineConnectionDidLost:

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

Event of loss connection with server. This event is reported after the connection is interrupted and exceed the retry period (10 seconds by default). In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel.

Parameters
engineThe engine kit

◆ rtcEngine:reportRtcStats:

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

Statistics of rtc engine status. Updated every two seconds.

Parameters
engineThe engine kit
statsThe statistics of rtc status, including duration, sent bytes and received bytes

◆ rtcEngine:lastmileProbeTestResult:

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

Reports the last-mile network probe result.

The SDK triggers this callback within 30 seconds after the app calls the [startLastmileProbeTest]([AgoraRtcEngineKit startLastmileProbeTest:]) method.

Parameters
engineAgoraRtcEngineKit object.
resultThe uplink and downlink last-mile network probe test result, see [AgoraLastmileProbeResult](AgoraLastmileProbeResult).

◆ rtcEngine:didApiCallExecute:api:result:

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

Event of API call executed

Deprecated:
This callback is deprecated. Use other specific event callbacks instead.
Parameters
engineThe engine kit
apiThe API description
errorThe error code

◆ rtcEngine:uploadLogResultRequestId:success:reason:

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

Reports the user log upload result

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

◆ rtcEngine:didClientRoleChanged:newRole:newRoleOptions:

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

Event of cient role change. only take effect under broadcasting mode

Parameters
engineThe engine kit
oldRoleThe previous role of the local user
newRoleThe new role of the local user
newRoleOptionsThe client role options of the current role of the local user

◆ rtcEngine:didClientRoleChangeFailed:currentRole:

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

Event of cient role change. only take effect under broadcasting mode

Parameters
engineThe engine kit
reasonThe reason of the failure of the local user role switches
currentRoleThe current role of the user

◆ rtcEngine:didLeaveChannelWithStats:

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

The statistics of the call when leave channel

Parameters
engineThe engine kit
statsThe statistics of the call, including duration, sent bytes and received bytes

◆ rtcEngine:firstLocalAudioFramePublished:

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

Event of the first audio frame is sent.

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

◆ rtcEngine:localAudioStats:

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

The statistics of the local audio stream.

Same as [localAudioStatBlock]([AgoraRtcEngineKit localAudioStatBlock:]). The SDK updates the application on the statistics of the local audio stream once every two seconds.

Parameters
engineThe AgoraRtcEngineKit object.
statsAgoraRtcLocalAudioStats

◆ rtcEngine:audioMixingStateChanged:reasonCode:

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

Audio mixing state changed.

Parameters
engineThe AgoraRtcEngineKit object.
stateAgoraAudioMixingStateType
reasonCodeAgoraAudioMixingReasonType

◆ rtcEngine:audioMixingPositionChanged:

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

Reports current AudioMixing progress.

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

Parameters
positionCurrent AudioMixing progress (millisecond).

◆ rtcEngine:cameraExposureDidChangedToRect:

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

A camera exposure position changed.

Parameters
engineAgoraRtcEngineKit object
rectExposure rectangle in the local preview

◆ rtcEngine:firstLocalVideoFramePublishedWithElapsed:sourceType:

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

Event of the first local video frame is published.

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

◆ rtcEngine:firstLocalVideoFrameWithSize:elapsed:sourceType:

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

Event of the first local frame starts rendering on the screen.

Parameters
engineThe engine kit
sizeThe size of local video stream
elapsedThe elapsed time(ms) from the beginning of the session.

◆ rtcEngine:localVideoStats:sourceType:

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

The statistics of local video stream. Update every two seconds.

Parameters
engineThe engine kit
statsThe statistics of local video, including sent bitrate, sent framerate

◆ rtcEngine:reportAudioVolumeIndicationOfSpeakers:totalVolume:

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

The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API "enableAudioVolumeIndication"

Parameters
engineThe engine kit
speakersAgoraRtcAudioVolumeInfo array
totalVolumeThe total volume of speakers

◆ rtcEngine:remoteAudioStats:

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

The statistics of remote audio stream. Update every two seconds.

Parameters
engineThe engine kit
statsThe statistics of audio video, including user id, delay, resolution, received bitrate, received framerate, audio stream type

◆ rtcEngine:remoteVideoStats:

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

The statistics of remote video stream. Update every two seconds.

Parameters
engineThe engine kit
statsThe statistics of remote video, including user id, delay, resolution, received bitrate, received framerate, video stream type

◆ rtcEngine:rtmpStreamingChangedToState:state:errCode:

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

◆ rtcEngine:rtmpStreamingEventWithUrl:eventCode:

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

◆ rtcEngine:facePositionDidChangeWidth:previewHeight:faces:

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

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

Since:** v3.0.1.

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

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

    Note**

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

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