@@ -308,30 +308,65 @@ - (void)leaveChannel {
308308}
309309
310310#pragma mark - <AgoraRtcEngineDelegate>
311+
312+ // / Occurs when the local user joins a specified channel.
313+ // / @param engine - RTC engine instance
314+ // / @param channel - Channel name
315+ // / @param uid - User ID of the remote user sending the video stream.
316+ // / @param elapsed - Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.
311317- (void )rtcEngine : (AgoraRtcEngineKit *)engine didJoinChannel : (NSString *)channel withUid : (NSUInteger )uid elapsed : (NSInteger )elapsed {
312318 [self info: [NSString stringWithFormat: @" Join channel: %@ " , channel]];
313319}
314320
321+
322+ // / Occurs when the connection between the SDK and the server is interrupted.
323+ // / The SDK triggers this callback when it loses connection with the server for more than four seconds after a connection is established.
324+ // / After triggering this callback, the SDK tries reconnecting to the server. You can use this callback to implement pop-up reminders.
325+ // / @param engine - RTC engine instance
315326- (void )rtcEngineConnectionDidInterrupted : (AgoraRtcEngineKit *)engine {
316327 [self alert: @" Connection Interrupted" ];
317328}
318329
330+ // / Occurs when the SDK cannot reconnect to Agora’s edge server 10 seconds after its connection to the server is interrupted.
331+ // / @param engine - RTC engine instance
319332- (void )rtcEngineConnectionDidLost : (AgoraRtcEngineKit *)engine {
320333 [self alert: @" Connection Lost" ];
321334}
322335
336+
337+ // / Reports an error during SDK runtime.
338+ // / @param engine - RTC engine instance
339+ // / @param errorCode - see complete list on this page
340+ // / https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraErrorCode.html
323341- (void )rtcEngine : (AgoraRtcEngineKit *)engine didOccurError : (AgoraErrorCode)errorCode {
324342 [self alert: [NSString stringWithFormat: @" Occur error: %ld " , errorCode]];
325343}
326344
327- // first remote video frame
345+ // / First remote video frame,Occurs when the first remote video frame is received and decoded.
346+ // / This callback is triggered in either of the following scenarios:
347+ // / * The remote user joins the channel and sends the video stream.
348+ // / * The remote user stops sending the video stream and re-sends it after 15 seconds. Possible reasons include:
349+ // / * The remote user leaves channel.
350+ // / * The remote user drops offline.
351+ // / * The remote user calls muteLocalVideoStream.
352+ // / * The remote user calls disableVideo.
353+ // /
354+ // / @param engine - RTC engine instance
355+ // / @param uid - User ID of the remote user sending the video stream.
356+ // / @param size - Size of the first local video frame (width and height).
357+ // / @param elapsed - Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK triggers this callback.
328358- (void )rtcEngine : (AgoraRtcEngineKit *)engine firstRemoteVideoDecodedOfUid : (NSUInteger )uid size : (CGSize)size elapsed : (NSInteger )elapsed {
329359 VideoSession *userSession = [self videoSessionOfUid: uid];
330360 userSession.size = size;
331361 [self .agoraKit setupRemoteVideo: userSession.canvas];
332362}
333363
334- // first local video frame
364+ // / First local video frame - occurs when the first local video frame is displayed/rendered on the local video view.
365+ // / @param engine - RTC engine instance
366+ // / @param size - Size of the first local video frame (width and height).
367+ // / @param elapsed - Time elapsed (ms) from the local user calling the joinChannelByToken method until the SDK calls this callback.
368+ // / If the startPreview method is called before the joinChannelByToken method, then elapsed is the time elapsed from
369+ // / calling the startPreview method until the SDK triggers this callback.
335370- (void )rtcEngine : (AgoraRtcEngineKit *)engine firstLocalVideoFrameWithSize : (CGSize)size elapsed : (NSInteger )elapsed {
336371 if (self.videoSessions .count ) {
337372 VideoSession *selfSession = self.videoSessions .firstObject ;
@@ -341,7 +376,11 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstLocalVideoFrameWithSize:(CGSi
341376 }
342377}
343378
344- // user offline
379+ // / Occurs when a remote user (Communication)/host (Live Broadcast) leaves a channel.
380+ // / @param engine - RTC engine instance
381+ // / @param uid - User ID of the remote user sending the video stream.
382+ // / @param reason - reason why user went offline, see complete list of the reasons:
383+ // / https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraUserOfflineReason.html
345384- (void )rtcEngine : (AgoraRtcEngineKit *)engine didOfflineOfUid : (NSUInteger )uid reason : (AgoraUserOfflineReason)reason {
346385 VideoSession *deleteSession;
347386 for (VideoSession *session in self.videoSessions ) {
@@ -365,18 +404,25 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOfflineOfUid:(NSUInteger)uid re
365404 }
366405}
367406
368- // video muted
407+ // / Occurs when a remote user’s video stream playback pauses/resumes.
408+ // / @param engine - RTC engine instance
409+ // / @param muted - true if muted; false otherwise
410+ // / @param uid - User ID of the remote user sending the video stream.
369411- (void )rtcEngine : (AgoraRtcEngineKit *)engine didVideoMuted : (BOOL )muted byUid : (NSUInteger )uid {
370412 [self setVideoMuted: muted forUid: uid];
371413}
372414
373- // remote stat
415+ // / Reports the statistics of the video stream from each remote user/host.
416+ // / @param engine - RTC engine instance
417+ // / @param stats - Statistics of the received remote video streams. See complete listing at
418+ // / https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcRemoteVideoStats.html
374419- (void )rtcEngine : (AgoraRtcEngineKit *)engine remoteVideoStats : (AgoraRtcRemoteVideoStats *)stats {
375420 VideoSession *session = [self fetchSessionOfUid: stats.uid];
376421 [session updateMediaInfo: CGSizeMake (stats.width, stats.height) fps: stats.rendererOutputFrameRate];
377422}
378423
379- // audio mixing
424+ // / Occurs when the audio mixing file playback finishes.
425+ // / @param engine - RTC engine instance
380426- (void )rtcEngineLocalAudioMixingDidFinish : (AgoraRtcEngineKit *)engine {
381427 self.isAudioMixing = NO ;
382428}
0 commit comments