Skip to content

Commit cbf5c66

Browse files
committed
Merge branch 'devrel/eco82' of https://github.com/icywind/Basic-Video-Call into devrel/eco82
2 parents 4d8d193 + a9088ff commit cbf5c66

File tree

2 files changed

+64
-6
lines changed

2 files changed

+64
-6
lines changed

Group-Video/OpenVideoCall-iOS-Objective-C/OpenVideoCall/LastmileViewController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
#import "LastmileViewController.h"
1010

11+
/// LastmileViewController implements various last mille related delegate functions for AgoraRtcEngine.
12+
/// "Last mile" refers to the connection between the local device and Agora's edge server.
1113
@interface LastmileViewController () <AgoraRtcEngineDelegate>
14+
1215
@property (weak, nonatomic) IBOutlet UILabel *qualityLabel;
1316
@property (weak, nonatomic) IBOutlet UILabel *rttLabel;
1417
@property (weak, nonatomic) IBOutlet UILabel *uplinkLabel;
@@ -64,6 +67,11 @@ - (void)addActivityView {
6467
}
6568

6669
#pragma mark - AgoraRtcEngineDelegate
70+
71+
/// Reports the last mile network quality of the local user once every two seconds before the user joins a channel.
72+
/// @param engine - RTC engine instance
73+
/// @param quality -The last mile network quality based on the uplink and dowlink packet loss rate and jitter. See list at:
74+
/// https://docs.agora.io/en/Video/API%20Reference/oc/Constants/AgoraNetworkQuality.html
6775
- (void)rtcEngine:(AgoraRtcEngineKit *)engine lastmileQuality:(AgoraNetworkQuality)quality {
6876
NSString *string;
6977
switch (quality) {
@@ -80,6 +88,10 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine lastmileQuality:(AgoraNetworkQuali
8088
self.qualityLabel.text = string;
8189
}
8290

91+
/// Reports the last-mile network probe result.
92+
/// @param engine - RTC engine instance
93+
/// @param result - The uplink and downlink last-mile network probe test result, see list here:
94+
/// https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraLastmileProbeResult.html
8395
- (void)rtcEngine:(AgoraRtcEngineKit *)engine lastmileProbeTestResult:(AgoraLastmileProbeResult *)result {
8496
self.rttLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)result.rtt];
8597
self.uplinkLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)result.uplinkReport.packetLossRate];

Group-Video/OpenVideoCall-iOS-Objective-C/OpenVideoCall/RoomViewController.m

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)