|
@@ -47,21 +47,25 @@
|
47
|
47
|
return toSend;
|
48
|
48
|
}
|
49
|
49
|
|
50
|
|
-- (void)receiveMetadata:(NSData *_Nonnull)data fromUser:(NSInteger)uid atTimestamp:(NSTimeInterval)timestamp {
|
|
50
|
+- (void)receiveMetadata:(NSData *_Nonnull)data fromUser:(NSUInteger)uid atTimestamp:(NSTimeInterval)timestamp {
|
51
|
51
|
NSString *dataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
52
|
52
|
[self sendEvent:AGMediaMetaDataReceived params:@{
|
53
|
|
- @"uid": @(uid),
|
54
|
|
- @"data": dataStr,
|
55
|
|
- @"ts": @(timestamp)
|
56
|
|
- }];
|
|
53
|
+ @"uid": @(uid),
|
|
54
|
+ @"data": dataStr,
|
|
55
|
+ @"ts": @(timestamp)
|
|
56
|
+ }];
|
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
|
60
|
60
|
RCT_EXPORT_MODULE();
|
61
|
61
|
|
|
62
|
+- (UIColor *) UIColorFromRGB:(NSUInteger)rgbValue {
|
|
63
|
+ return [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0];
|
|
64
|
+}
|
|
65
|
+
|
62
|
66
|
- (AgoraImage *) makeAgoraImage:(NSDictionary *)options {
|
63
|
67
|
AgoraImage *img = [AgoraImage new];
|
64
|
|
- img.url = [NSURL URLWithString:[options[@"url"] stringValue]];
|
|
68
|
+ img.url = [NSURL URLWithString:options[@"url"]];
|
65
|
69
|
|
66
|
70
|
img.rect = CGRectMake((CGFloat)[options[@"x"] floatValue],
|
67
|
71
|
(CGFloat)[options[@"y"] floatValue],
|
|
@@ -163,7 +167,7 @@ RCT_EXPORT_MODULE();
|
163
|
167
|
@"ChannelProfileGame": @(AgoraChannelProfileGame),
|
164
|
168
|
@"AudioMode": @(AgoraAudioMode),
|
165
|
169
|
@"VideoMode": @(AgoraVideoMode),
|
166
|
|
- };
|
|
170
|
+ };
|
167
|
171
|
}
|
168
|
172
|
|
169
|
173
|
// init
|
|
@@ -187,21 +191,21 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
|
187
|
191
|
});
|
188
|
192
|
if ([options objectForKey:@"mode"]) {
|
189
|
193
|
switch([options[@"mode"] integerValue]) {
|
190
|
|
- case AgoraAudioMode: {
|
191
|
|
- [self.rtcEngine enableLocalAudio:true];
|
192
|
|
- [self.rtcEngine enableLocalVideo:false];
|
193
|
|
- break;
|
194
|
|
- }
|
195
|
|
- case AgoraVideoMode: {
|
196
|
|
- [self.rtcEngine enableLocalVideo:true];
|
197
|
|
- [self.rtcEngine enableLocalAudio:false];
|
198
|
|
- break;
|
199
|
|
- }
|
|
194
|
+ case AgoraAudioMode: {
|
|
195
|
+ [self.rtcEngine enableLocalAudio:true];
|
|
196
|
+ [self.rtcEngine enableLocalVideo:false];
|
|
197
|
+ break;
|
|
198
|
+ }
|
|
199
|
+ case AgoraVideoMode: {
|
|
200
|
+ [self.rtcEngine enableLocalVideo:true];
|
|
201
|
+ [self.rtcEngine enableLocalAudio:false];
|
|
202
|
+ break;
|
|
203
|
+ }
|
200
|
204
|
}
|
201
|
|
- } else {
|
202
|
|
- [self.rtcEngine enableLocalVideo:true];
|
203
|
|
- [self.rtcEngine enableLocalAudio:true];
|
204
|
|
- }
|
|
205
|
+ } else {
|
|
206
|
+ [self.rtcEngine enableLocalVideo:true];
|
|
207
|
+ [self.rtcEngine enableLocalAudio:true];
|
|
208
|
+ }
|
205
|
209
|
|
206
|
210
|
if ([options objectForKey:@"beauty"]) {
|
207
|
211
|
AgoraBeautyOptions *beautyOption = [[AgoraBeautyOptions alloc] init];
|
|
@@ -209,7 +213,7 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
|
209
|
213
|
beautyOption.lighteningLevel = [options[@"beauty"][@"lighteningLevel"] floatValue];
|
210
|
214
|
beautyOption.smoothnessLevel = [options[@"beauty"][@"smoothnessLevel"] floatValue];
|
211
|
215
|
beautyOption.rednessLevel = [options[@"beauty"][@"rednessLevel"] floatValue];
|
212
|
|
- [self.rtcEngine setBeautyEffectOptions:true options:beautyOption];
|
|
216
|
+ [self.rtcEngine setBeautyEffectOptions:true options:beautyOption];
|
213
|
217
|
}
|
214
|
218
|
if ([options objectForKey:@"voice"]) {
|
215
|
219
|
NSInteger voiceValue = [options[@"voice"][@"value"] integerValue];
|
|
@@ -221,22 +225,22 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
|
221
|
225
|
[self.rtcEngine setLocalVoiceReverbPreset:(AgoraAudioReverbPreset)voiceValue];
|
222
|
226
|
}
|
223
|
227
|
}
|
224
|
|
- if (options[@"secret"] != nil) {
|
225
|
|
- [self.rtcEngine setEncryptionSecret:[options[@"secret"] stringValue]];
|
226
|
|
- if (options[@"secretMode"] != nil) {
|
227
|
|
- [self.rtcEngine setEncryptionMode:[options[@"secretMode"] stringValue]];
|
228
|
|
- }
|
229
|
|
- }
|
230
|
|
-
|
231
|
|
- AgoraVideoEncoderConfiguration *video_encoder_config = [[AgoraVideoEncoderConfiguration new] initWithWidth:[options[@"videoEncoderConfig"][@"width"] integerValue] height:[options[@"videoEncoderConfig"][@"height"] integerValue] frameRate:[options[@"videoEncoderConfig"][@"frameRate"] integerValue] bitrate:[options[@"videoEncoderConfig"][@"bitrate"] integerValue] orientationMode: (AgoraVideoOutputOrientationMode)[options[@"videoEncoderConfig"][@"orientationMode"] integerValue]];
|
232
|
|
- [self.rtcEngine setVideoEncoderConfiguration:video_encoder_config];
|
233
|
|
- [self.rtcEngine setClientRole:(AgoraClientRole)[options[@"clientRole"] integerValue]];
|
234
|
|
- [self.rtcEngine setAudioProfile:(AgoraAudioProfile)[options[@"audioProfile"] integerValue]
|
235
|
|
- scenario:(AgoraAudioScenario)[options[@"audioScenario"] integerValue]];
|
236
|
|
-
|
237
|
|
- //Enable Agora Native SDK be Interoperable with Agora Web SDK
|
238
|
|
- [self.rtcEngine enableWebSdkInteroperability:YES];
|
239
|
|
- }
|
|
228
|
+ if (options[@"secret"] != nil) {
|
|
229
|
+ [self.rtcEngine setEncryptionSecret:[options[@"secret"] stringValue]];
|
|
230
|
+ if (options[@"secretMode"] != nil) {
|
|
231
|
+ [self.rtcEngine setEncryptionMode:[options[@"secretMode"] stringValue]];
|
|
232
|
+ }
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ AgoraVideoEncoderConfiguration *video_encoder_config = [[AgoraVideoEncoderConfiguration new] initWithWidth:[options[@"videoEncoderConfig"][@"width"] integerValue] height:[options[@"videoEncoderConfig"][@"height"] integerValue] frameRate:[options[@"videoEncoderConfig"][@"frameRate"] integerValue] bitrate:[options[@"videoEncoderConfig"][@"bitrate"] integerValue] orientationMode: (AgoraVideoOutputOrientationMode)[options[@"videoEncoderConfig"][@"orientationMode"] integerValue]];
|
|
236
|
+ [self.rtcEngine setVideoEncoderConfiguration:video_encoder_config];
|
|
237
|
+ [self.rtcEngine setClientRole:(AgoraClientRole)[options[@"clientRole"] integerValue]];
|
|
238
|
+ [self.rtcEngine setAudioProfile:(AgoraAudioProfile)[options[@"audioProfile"] integerValue]
|
|
239
|
+ scenario:(AgoraAudioScenario)[options[@"audioScenario"] integerValue]];
|
|
240
|
+
|
|
241
|
+ //Enable Agora Native SDK be Interoperable with Agora Web SDK
|
|
242
|
+ [self.rtcEngine enableWebSdkInteroperability:YES];
|
|
243
|
+}
|
240
|
244
|
|
241
|
245
|
// renew token
|
242
|
246
|
RCT_EXPORT_METHOD(renewToken
|
|
@@ -286,7 +290,7 @@ RCT_EXPORT_METHOD(setClientRole:(NSInteger)role
|
286
|
290
|
RCT_EXPORT_METHOD(joinChannel:(NSDictionary *)options
|
287
|
291
|
resolve:(RCTPromiseResolveBlock)resolve
|
288
|
292
|
reject:(RCTPromiseRejectBlock)reject) {
|
289
|
|
- [AgoraConst share].localUid = [options[@"uid"] integerValue];
|
|
293
|
+ [AgoraConst share].localUid = (NSUInteger)[options[@"uid"] integerValue];
|
290
|
294
|
NSInteger res = [self.rtcEngine joinChannelByToken:options[@"token"] channelId:options[@"channelName"] info:options[@"info"] uid:[AgoraConst share].localUid joinSuccess:nil];
|
291
|
295
|
if (res == 0) {
|
292
|
296
|
resolve(nil);
|
|
@@ -301,19 +305,19 @@ RCT_EXPORT_METHOD(leaveChannel
|
301
|
305
|
reject:(RCTPromiseRejectBlock) reject) {
|
302
|
306
|
NSInteger res = [self.rtcEngine leaveChannel:^(AgoraChannelStats * _Nonnull stat) {
|
303
|
307
|
[self sendEvent:AGLeaveChannel params:@{
|
304
|
|
- @"message": @"leaveChannel",
|
305
|
|
- @"duration": @(stat.duration),
|
306
|
|
- @"txBytes": @(stat.txBytes),
|
307
|
|
- @"rxBytes": @(stat.rxBytes),
|
308
|
|
- @"txAudioKBitrate": @(stat.txAudioKBitrate),
|
309
|
|
- @"rxAudioKBitrate": @(stat.rxAudioKBitrate),
|
310
|
|
- @"txVideoKBitrate": @(stat.txVideoKBitrate),
|
311
|
|
- @"rxVideoKBitrate": @(stat.rxVideoKBitrate),
|
312
|
|
- @"lastmileDelay": @(stat.lastmileDelay),
|
313
|
|
- @"userCount": @(stat.userCount),
|
314
|
|
- @"cpuAppUsage": @(stat.cpuAppUsage),
|
315
|
|
- @"cpuTotalUsage": @(stat.cpuTotalUsage)
|
316
|
|
- }];
|
|
308
|
+ @"message": @"leaveChannel",
|
|
309
|
+ @"duration": @(stat.duration),
|
|
310
|
+ @"txBytes": @(stat.txBytes),
|
|
311
|
+ @"rxBytes": @(stat.rxBytes),
|
|
312
|
+ @"txAudioKBitrate": @(stat.txAudioKBitrate),
|
|
313
|
+ @"rxAudioKBitrate": @(stat.rxAudioKBitrate),
|
|
314
|
+ @"txVideoKBitrate": @(stat.txVideoKBitrate),
|
|
315
|
+ @"rxVideoKBitrate": @(stat.rxVideoKBitrate),
|
|
316
|
+ @"lastmileDelay": @(stat.lastmileDelay),
|
|
317
|
+ @"userCount": @(stat.userCount),
|
|
318
|
+ @"cpuAppUsage": @(stat.cpuAppUsage),
|
|
319
|
+ @"cpuTotalUsage": @(stat.cpuTotalUsage)
|
|
320
|
+ }];
|
317
|
321
|
}];
|
318
|
322
|
if (res == 0) {
|
319
|
323
|
resolve(nil);
|
|
@@ -341,7 +345,7 @@ RCT_EXPORT_METHOD(setLocalRenderMode:(NSInteger) mode
|
341
|
345
|
}
|
342
|
346
|
|
343
|
347
|
// set remote video render mode
|
344
|
|
-RCT_EXPORT_METHOD(setRemoteRenderMode:(NSInteger) uid
|
|
348
|
+RCT_EXPORT_METHOD(setRemoteRenderMode:(NSUInteger) uid
|
345
|
349
|
mode:(NSInteger) mode
|
346
|
350
|
resolve:(RCTPromiseResolveBlock) resolve
|
347
|
351
|
reject:(RCTPromiseRejectBlock) reject) {
|
|
@@ -597,8 +601,8 @@ RCT_EXPORT_METHOD(adjustPlaybackSignalVolume: (NSInteger) volume
|
597
|
601
|
|
598
|
602
|
// enable audio volume indication
|
599
|
603
|
RCT_EXPORT_METHOD(enableAudioVolumeIndication: (NSInteger) interval smooth:(NSInteger)smooth
|
600
|
|
- resolve:(RCTPromiseResolveBlock)resolve
|
601
|
|
- reject:(RCTPromiseRejectBlock)reject) {
|
|
604
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
605
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
602
|
606
|
NSInteger res = [self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth];
|
603
|
607
|
if (res == 0) {
|
604
|
608
|
resolve(nil);
|
|
@@ -678,9 +682,9 @@ RCT_EXPORT_METHOD(startAudioMixing:(NSDictionary *) options
|
678
|
682
|
resolve:(RCTPromiseResolveBlock)resolve
|
679
|
683
|
reject:(RCTPromiseRejectBlock)reject) {
|
680
|
684
|
NSInteger res = [self.rtcEngine startAudioMixing:[options[@"filepath"] stringValue]
|
681
|
|
- loopback:[options[@"loopback"] boolValue]
|
682
|
|
- replace:[options[@"replace"] boolValue]
|
683
|
|
- cycle:[options[@"cycle"] integerValue]];
|
|
685
|
+ loopback:[options[@"loopback"] boolValue]
|
|
686
|
+ replace:[options[@"replace"] boolValue]
|
|
687
|
+ cycle:[options[@"cycle"] integerValue]];
|
684
|
688
|
if (res == 0) {
|
685
|
689
|
resolve(nil);
|
686
|
690
|
} else {
|
|
@@ -1259,7 +1263,7 @@ RCT_EXPORT_METHOD(getCameraInfo
|
1259
|
1263
|
@"focusPositionInPreview": @([self.rtcEngine isCameraFocusPositionInPreviewSupported]),
|
1260
|
1264
|
@"exposurePosition": @([self.rtcEngine isCameraExposurePositionSupported]),
|
1261
|
1265
|
@"autoFocusFaceMode": @([self.rtcEngine isCameraAutoFocusFaceModeSupported])
|
1262
|
|
- }
|
|
1266
|
+ }
|
1263
|
1267
|
});
|
1264
|
1268
|
}
|
1265
|
1269
|
|
|
@@ -1387,44 +1391,31 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options
|
1387
|
1391
|
resolve:(RCTPromiseResolveBlock) resolve
|
1388
|
1392
|
reject:(RCTPromiseRejectBlock) reject) {
|
1389
|
1393
|
AgoraLiveTranscoding *transcoding = AgoraLiveTranscoding.defaultTranscoding;
|
1390
|
|
- if (options[@"size"] != nil) {
|
|
1394
|
+ if ([options objectForKey:@"size"]) {
|
1391
|
1395
|
transcoding.size = CGSizeMake([options[@"size"][@"width"] doubleValue], [options[@"size"][@"height"] doubleValue]);
|
1392
|
1396
|
}
|
1393
|
|
- if (options[@"videoBitrate"] != nil) {
|
|
1397
|
+ if ([options objectForKey:@"videoBitrate"]) {
|
1394
|
1398
|
transcoding.videoBitrate = [options[@"videoBitrate"] integerValue];
|
1395
|
1399
|
}
|
1396
|
|
- if (options[@"videoFramerate"] != nil) {
|
|
1400
|
+ if ([options objectForKey:@"videoFramerate"]) {
|
1397
|
1401
|
transcoding.videoFramerate = [options[@"videoFramerate"] integerValue];
|
1398
|
1402
|
}
|
1399
|
|
- if (options[@"lowLatency"] != nil) {
|
|
1403
|
+ if ([options objectForKey:@"lowLatancy"]) {
|
1400
|
1404
|
transcoding.lowLatency = [options[@"lowLatancy"] boolValue];
|
1401
|
1405
|
}
|
1402
|
|
- if (options[@"videoGop"] != nil) {
|
|
1406
|
+ if ([options objectForKey:@"videoGop"]) {
|
1403
|
1407
|
transcoding.videoGop = [options[@"videoGop"] integerValue];
|
1404
|
1408
|
}
|
1405
|
|
- if (options[@"videoCodecProfile"] != nil) {
|
|
1409
|
+ if ([options objectForKey:@"videoCodecProfile"]) {
|
1406
|
1410
|
transcoding.videoCodecProfile = (AgoraVideoCodecProfileType)[options[@"videoCodecProfile"] integerValue];
|
1407
|
1411
|
}
|
1408
|
|
- if (options[@"audioCodecProfile"] != nil) {
|
|
1412
|
+ if ([options objectForKey:@"audioCodecProfile"]) {
|
1409
|
1413
|
transcoding.audioCodecProfile = (AgoraAudioCodecProfileType)[options[@"audioCodecProfile"] integerValue];
|
1410
|
1414
|
}
|
1411
|
|
- if (options[@"transcodingUsers"] != nil) {
|
1412
|
|
- NSMutableArray<AgoraLiveTranscodingUser*> *transcodingUsers = [NSMutableArray new];
|
1413
|
|
- for (NSDictionary *optionUser in options[@"users"]) {
|
1414
|
|
- AgoraLiveTranscodingUser *liveUser = [AgoraLiveTranscodingUser new];
|
1415
|
|
- liveUser.uid = (NSUInteger)[optionUser[@"uid"] integerValue];
|
1416
|
|
- liveUser.rect = CGRectMake((CGFloat)[options[@"backgroundColor"][@"x"] floatValue], (CGFloat)[options[@"backgroundColor"][@"y"] floatValue], (CGFloat)[options[@"backgroundColor"][@"width"] floatValue], (CGFloat)[options[@"backgroundColor"][@"height"] floatValue]);
|
1417
|
|
- liveUser.zOrder = [optionUser[@"zOrder"] integerValue];
|
1418
|
|
- liveUser.alpha = [optionUser[@"alpha"] doubleValue];
|
1419
|
|
- liveUser.audioChannel = [optionUser[@"audioChannel"] integerValue];
|
1420
|
|
- [transcodingUsers addObject:liveUser];
|
1421
|
|
- }
|
1422
|
|
- transcoding.transcodingUsers = transcodingUsers;
|
1423
|
|
- }
|
1424
|
|
- if (options[@"transcodingExtraInfo"] != nil) {
|
1425
|
|
- transcoding.transcodingExtraInfo = [options[@"transcodingExtraInfo"] stringValue];
|
|
1415
|
+ if ([options objectForKey:@"audioSampleRate"]) {
|
|
1416
|
+ transcoding.audioSampleRate = (AgoraAudioSampleRateType)[options[@"audioSampleRate"] integerValue];
|
1426
|
1417
|
}
|
1427
|
|
- if (options[@"watermark"] != nil) {
|
|
1418
|
+ if ([options objectForKey:@"watermark"]) {
|
1428
|
1419
|
transcoding.watermark = [self makeAgoraImage:@{
|
1429
|
1420
|
@"url": options[@"watermark"][@"url"],
|
1430
|
1421
|
@"x": options[@"watermark"][@"x"],
|
|
@@ -1433,7 +1424,7 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options
|
1433
|
1424
|
@"height": options[@"watermark"][@"height"]
|
1434
|
1425
|
}];
|
1435
|
1426
|
}
|
1436
|
|
- if (options[@"backgroundImage"] != nil) {
|
|
1427
|
+ if ([options objectForKey:@"backgroundImage"]) {
|
1437
|
1428
|
transcoding.backgroundImage = [self makeAgoraImage:@{
|
1438
|
1429
|
@"url": options[@"backgroundImage"][@"url"],
|
1439
|
1430
|
@"x": options[@"backgroundImage"][@"x"],
|
|
@@ -1442,19 +1433,39 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options
|
1442
|
1433
|
@"height": options[@"backgroundImage"][@"height"]
|
1443
|
1434
|
}];
|
1444
|
1435
|
}
|
1445
|
|
- if (options[@"backgroundColor"] != nil) {
|
1446
|
|
- transcoding.backgroundColor = [[UIColor new] initWithRed:(CGFloat)[options[@"backgroundColor"][@"red"] floatValue] green:(CGFloat)[options[@"backgroundColor"][@"green"] floatValue] blue:(CGFloat)[options[@"backgroundColor"][@"blue"] floatValue] alpha:(CGFloat)[options[@"backgroundColor"][@"alpha"] floatValue]];
|
1447
|
|
- }
|
1448
|
|
- if (options[@"audioSampleRate"] != nil) {
|
1449
|
|
- transcoding.audioSampleRate = (AgoraAudioSampleRateType)[options[@"audioSampleRate"] integerValue];
|
|
1436
|
+
|
|
1437
|
+ if ([options objectForKey:@"backgroundColor"]) {
|
|
1438
|
+ transcoding.backgroundColor = [self UIColorFromRGB:(NSUInteger)[options[@"backgroundColor"] integerValue]];
|
1450
|
1439
|
}
|
1451
|
|
- if (options[@"audioBitrate"] != nil) {
|
|
1440
|
+
|
|
1441
|
+ if ([options objectForKey:@"audioBitrate"]) {
|
1452
|
1442
|
transcoding.audioBitrate = [options[@"audioBitrate"] integerValue];
|
1453
|
1443
|
}
|
1454
|
|
- if (options[@"audioChannels"] != nil) {
|
|
1444
|
+
|
|
1445
|
+ if ([options objectForKey:@"audioChannels"]) {
|
1455
|
1446
|
transcoding.audioChannels = [options[@"audioChannels"] integerValue];
|
1456
|
1447
|
}
|
1457
|
1448
|
|
|
1449
|
+ if ([options objectForKey:@"transcodingUsers"]) {
|
|
1450
|
+ NSMutableArray<AgoraLiveTranscodingUser*> *transcodingUsers = [NSMutableArray new];
|
|
1451
|
+ for (NSDictionary *optionUser in options[@"transcodingUsers"]) {
|
|
1452
|
+ AgoraLiveTranscodingUser *liveUser = [AgoraLiveTranscodingUser new];
|
|
1453
|
+ liveUser.uid = (NSUInteger)[optionUser[@"uid"] integerValue];
|
|
1454
|
+ liveUser.rect = CGRectMake((CGFloat)[optionUser[@"x"] floatValue],
|
|
1455
|
+ (CGFloat)[optionUser[@"y"] floatValue],
|
|
1456
|
+ (CGFloat)[optionUser[@"width"] floatValue],
|
|
1457
|
+ (CGFloat)[optionUser[@"height"] floatValue]);
|
|
1458
|
+ liveUser.zOrder = [optionUser[@"zOrder"] integerValue];
|
|
1459
|
+ liveUser.alpha = [optionUser[@"alpha"] doubleValue];
|
|
1460
|
+ liveUser.audioChannel = [optionUser[@"audioChannel"] integerValue];
|
|
1461
|
+ [transcodingUsers addObject:liveUser];
|
|
1462
|
+ }
|
|
1463
|
+ transcoding.transcodingUsers = transcodingUsers;
|
|
1464
|
+ }
|
|
1465
|
+ if ([options objectForKey:@"transcodingExtraInfo"]) {
|
|
1466
|
+ transcoding.transcodingExtraInfo = [options[@"transcodingExtraInfo"] stringValue];
|
|
1467
|
+ }
|
|
1468
|
+
|
1458
|
1469
|
NSInteger res = [self.rtcEngine setLiveTranscoding:transcoding];
|
1459
|
1470
|
if (res == 0) {
|
1460
|
1471
|
resolve(nil);
|
|
@@ -1508,7 +1519,7 @@ RCT_EXPORT_METHOD(enableSoundPositionIndication:(bool) enabled
|
1508
|
1519
|
}
|
1509
|
1520
|
}
|
1510
|
1521
|
|
1511
|
|
-RCT_EXPORT_METHOD(setRemoteVoicePosition:(NSInteger) uid
|
|
1522
|
+RCT_EXPORT_METHOD(setRemoteVoicePosition:(NSUInteger) uid
|
1512
|
1523
|
pan:(float)pan
|
1513
|
1524
|
gain:(float)gain
|
1514
|
1525
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
@@ -1529,7 +1540,7 @@ RCT_EXPORT_METHOD(startLastmileProbeTest:(NSDictionary*)config
|
1529
|
1540
|
probeConfig.probeDownlink = [config[@"probeDownlink"] boolValue];
|
1530
|
1541
|
probeConfig.expectedUplinkBitrate = [config[@"expectedUplinkBitrate"] integerValue];
|
1531
|
1542
|
probeConfig.expectedDownlinkBitrate = [config[@"expectedDownlinkBitrate"] integerValue];
|
1532
|
|
-
|
|
1543
|
+
|
1533
|
1544
|
NSInteger res = [self.rtcEngine startLastmileProbeTest:probeConfig];
|
1534
|
1545
|
if (res == 0) {
|
1535
|
1546
|
resolve(nil);
|
|
@@ -1543,7 +1554,7 @@ RCT_EXPORT_METHOD(setRemoteUserPriority:(NSUInteger)uid
|
1543
|
1554
|
userPriority:(NSInteger)userPriority
|
1544
|
1555
|
resolve:(RCTPromiseResolveBlock)resolve
|
1545
|
1556
|
reject:(RCTPromiseRejectBlock)reject) {
|
1546
|
|
-
|
|
1557
|
+
|
1547
|
1558
|
NSInteger res = [self.rtcEngine setRemoteUserPriority:uid type:(AgoraUserPriority)userPriority];
|
1548
|
1559
|
if (res == 0) {
|
1549
|
1560
|
resolve(nil);
|
|
@@ -1602,8 +1613,8 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
1602
|
1613
|
:(RCTPromiseResolveBlock)resolve
|
1603
|
1614
|
reject:(RCTPromiseRejectBlock)reject) {
|
1604
|
1615
|
if (YES == [_rtcEngine setMediaMetadataDataSource:self withType:AgoraMetadataTypeVideo] &&
|
1605
|
|
- YES == [_rtcEngine setMediaMetadataDelegate:self withType:AgoraMetadataTypeVideo]
|
1606
|
|
- ) {
|
|
1616
|
+ YES == [_rtcEngine setMediaMetadataDelegate:self withType:AgoraMetadataTypeVideo]
|
|
1617
|
+ ) {
|
1607
|
1618
|
resolve(nil);
|
1608
|
1619
|
} else {
|
1609
|
1620
|
reject(@(-1).stringValue, @(-1).stringValue, nil);
|
|
@@ -1642,72 +1653,72 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
1642
|
1653
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didApiCallExecute:(NSInteger)error api:(NSString *_Nonnull)api result:(NSString *_Nonnull)result {
|
1643
|
1654
|
if (error != 0) {
|
1644
|
1655
|
[self sendEvent:AGError params:@{
|
1645
|
|
- @"api": api,
|
1646
|
|
- @"result": result,
|
1647
|
|
- @"error": @(error)
|
1648
|
|
- }];
|
|
1656
|
+ @"api": api,
|
|
1657
|
+ @"result": result,
|
|
1658
|
+ @"error": @(error)
|
|
1659
|
+ }];
|
1649
|
1660
|
} else {
|
1650
|
1661
|
[self sendEvent:AGApiCallExecute params:@{
|
1651
|
|
- @"api": api,
|
1652
|
|
- @"result": result,
|
1653
|
|
- @"error": @(error)
|
1654
|
|
- }];
|
|
1662
|
+ @"api": api,
|
|
1663
|
+ @"result": result,
|
|
1664
|
+ @"error": @(error)
|
|
1665
|
+ }];
|
1655
|
1666
|
}
|
1656
|
1667
|
}
|
1657
|
1668
|
|
1658
|
1669
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didJoinChannel:(NSString *_Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed {
|
1659
|
1670
|
[self sendEvent:AGJoinChannelSuccess params:@{
|
1660
|
|
- @"channel": channel,
|
1661
|
|
- @"uid": @(uid),
|
1662
|
|
- @"elapsed": @(elapsed)
|
1663
|
|
- }];
|
|
1671
|
+ @"channel": channel,
|
|
1672
|
+ @"uid": @(uid),
|
|
1673
|
+ @"elapsed": @(elapsed)
|
|
1674
|
+ }];
|
1664
|
1675
|
}
|
1665
|
1676
|
|
1666
|
1677
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didRejoinChannel:(NSString *_Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed {
|
1667
|
1678
|
[self sendEvent:AGRejoinChannelSuccess params:@{
|
1668
|
|
- @"channel": channel,
|
1669
|
|
- @"uid": @(uid),
|
1670
|
|
- @"elapsed": @(elapsed)
|
1671
|
|
- }];
|
|
1679
|
+ @"channel": channel,
|
|
1680
|
+ @"uid": @(uid),
|
|
1681
|
+ @"elapsed": @(elapsed)
|
|
1682
|
+ }];
|
1672
|
1683
|
}
|
1673
|
1684
|
|
1674
|
1685
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLeaveChannelWithStats:(AgoraChannelStats *_Nonnull)stats {
|
1675
|
1686
|
[self sendEvent:AGLeaveChannel params:@{
|
1676
|
|
- @"stats": @{
|
1677
|
|
- @"duration": @(stats.duration),
|
1678
|
|
- @"txBytes": @(stats.txBytes),
|
1679
|
|
- @"rxBytes": @(stats.rxBytes),
|
1680
|
|
- @"txAudioKBitrate": @(stats.txAudioKBitrate),
|
1681
|
|
- @"rxAudioKBitrate": @(stats.rxVideoKBitrate),
|
1682
|
|
- @"txVideoKBitrate": @(stats.txVideoKBitrate),
|
1683
|
|
- @"rxVideoKBitrate": @(stats.rxVideoKBitrate),
|
1684
|
|
- @"lastmileDelay": @(stats.lastmileDelay),
|
1685
|
|
- @"userCount": @(stats.userCount),
|
1686
|
|
- @"cpuAppUsage": @(stats.cpuAppUsage),
|
1687
|
|
- @"cpuTotalUsage": @(stats.cpuTotalUsage)
|
1688
|
|
- }
|
1689
|
|
- }];
|
|
1687
|
+ @"stats": @{
|
|
1688
|
+ @"duration": @(stats.duration),
|
|
1689
|
+ @"txBytes": @(stats.txBytes),
|
|
1690
|
+ @"rxBytes": @(stats.rxBytes),
|
|
1691
|
+ @"txAudioKBitrate": @(stats.txAudioKBitrate),
|
|
1692
|
+ @"rxAudioKBitrate": @(stats.rxVideoKBitrate),
|
|
1693
|
+ @"txVideoKBitrate": @(stats.txVideoKBitrate),
|
|
1694
|
+ @"rxVideoKBitrate": @(stats.rxVideoKBitrate),
|
|
1695
|
+ @"lastmileDelay": @(stats.lastmileDelay),
|
|
1696
|
+ @"userCount": @(stats.userCount),
|
|
1697
|
+ @"cpuAppUsage": @(stats.cpuAppUsage),
|
|
1698
|
+ @"cpuTotalUsage": @(stats.cpuTotalUsage)
|
|
1699
|
+ }
|
|
1700
|
+ }];
|
1690
|
1701
|
}
|
1691
|
1702
|
|
1692
|
1703
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didClientRoleChanged:(AgoraClientRole)oldRole newRole:(AgoraClientRole)newRole {
|
1693
|
1704
|
[self sendEvent:AGClientRoleChanged params:@{
|
1694
|
|
- @"oldRole": @(oldRole),
|
1695
|
|
- @"newRole": @(newRole)
|
1696
|
|
- }];
|
|
1705
|
+ @"oldRole": @(oldRole),
|
|
1706
|
+ @"newRole": @(newRole)
|
|
1707
|
+ }];
|
1697
|
1708
|
}
|
1698
|
1709
|
|
1699
|
1710
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didJoinedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed {
|
1700
|
1711
|
[self sendEvent:AGUserJoined params:@{
|
1701
|
|
- @"uid": @(uid),
|
1702
|
|
- @"elapsed": @(elapsed)
|
1703
|
|
- }];
|
|
1712
|
+ @"uid": @(uid),
|
|
1713
|
+ @"elapsed": @(elapsed)
|
|
1714
|
+ }];
|
1704
|
1715
|
}
|
1705
|
1716
|
|
1706
|
1717
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didOfflineOfUid:(NSUInteger)uid reason:(AgoraUserOfflineReason)reason {
|
1707
|
1718
|
[self sendEvent:AGUserOffline params:@{
|
1708
|
|
- @"uid": @(uid),
|
1709
|
|
- @"reason": @(reason)
|
1710
|
|
- }];
|
|
1719
|
+ @"uid": @(uid),
|
|
1720
|
+ @"reason": @(reason)
|
|
1721
|
+ }];
|
1711
|
1722
|
}
|
1712
|
1723
|
|
1713
|
1724
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine networkTypeChangedToType:(AgoraNetworkType)type {
|
|
@@ -1725,26 +1736,26 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
1725
|
1736
|
|
1726
|
1737
|
- (void)rtcEngineConnectionDidLost:(AgoraRtcEngineKit *_Nonnull)engine {
|
1727
|
1738
|
[self sendEvent:AGConnectionLost params:@{
|
1728
|
|
- @"message": @"connectionLost"
|
1729
|
|
- }];
|
|
1739
|
+ @"message": @"connectionLost"
|
|
1740
|
+ }];
|
1730
|
1741
|
}
|
1731
|
1742
|
|
1732
|
1743
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine tokenPrivilegeWillExpire:(NSString *_Nonnull)token {
|
1733
|
1744
|
[self sendEvent:AGTokenPrivilegeWillExpire params:@{
|
1734
|
|
- @"token": token
|
1735
|
|
- }];
|
|
1745
|
+ @"token": token
|
|
1746
|
+ }];
|
1736
|
1747
|
}
|
1737
|
1748
|
|
1738
|
1749
|
- (void)rtcEngineRequestToken:(AgoraRtcEngineKit *_Nonnull)engine {
|
1739
|
1750
|
[self sendEvent:AGRequestToken params:@{
|
1740
|
|
- @"message": @"RequestToken"
|
1741
|
|
- }];
|
|
1751
|
+ @"message": @"RequestToken"
|
|
1752
|
+ }];
|
1742
|
1753
|
}
|
1743
|
1754
|
|
1744
|
1755
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didMicrophoneEnabled:(BOOL)enabled {
|
1745
|
1756
|
[self sendEvent:AGMicrophoneEnabled params:@{
|
1746
|
|
- @"enabled": @(enabled)
|
1747
|
|
- }];
|
|
1757
|
+ @"enabled": @(enabled)
|
|
1758
|
+ }];
|
1748
|
1759
|
}
|
1749
|
1760
|
|
1750
|
1761
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine reportAudioVolumeIndicationOfSpeakers:(NSArray<AgoraRtcAudioVolumeInfo*> *_Nonnull)speakers totalVolume:(NSInteger)totalVolume {
|
|
@@ -1756,28 +1767,28 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
1756
|
1767
|
}];
|
1757
|
1768
|
}
|
1758
|
1769
|
[self sendEvent:AGAudioVolumeIndication params:@{
|
1759
|
|
- @"speakers": result,
|
1760
|
|
- @"totalVolume": @(totalVolume)
|
1761
|
|
- }];
|
|
1770
|
+ @"speakers": result,
|
|
1771
|
+ @"totalVolume": @(totalVolume)
|
|
1772
|
+ }];
|
1762
|
1773
|
}
|
1763
|
1774
|
|
1764
|
1775
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine activeSpeaker:(NSUInteger)speakerUid {
|
1765
|
1776
|
[self sendEvent:AGActiveSpeaker params:@{
|
1766
|
|
- @"uid": @(speakerUid)
|
1767
|
|
- }];
|
|
1777
|
+ @"uid": @(speakerUid)
|
|
1778
|
+ }];
|
1768
|
1779
|
}
|
1769
|
1780
|
|
1770
|
1781
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstLocalAudioFrame:(NSInteger)elapsed {
|
1771
|
1782
|
[self sendEvent:AGFirstLocalAudioFrame params:@{
|
1772
|
|
- @"elapsed": @(elapsed)
|
1773
|
|
- }];
|
|
1783
|
+ @"elapsed": @(elapsed)
|
|
1784
|
+ }];
|
1774
|
1785
|
}
|
1775
|
1786
|
|
1776
|
1787
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed {
|
1777
|
1788
|
[self sendEvent:AGFirstRemoteAudioFrame params:@{
|
1778
|
|
- @"uid": @(uid),
|
1779
|
|
- @"elapsed": @(elapsed)
|
1780
|
|
- }];
|
|
1789
|
+ @"uid": @(uid),
|
|
1790
|
+ @"elapsed": @(elapsed)
|
|
1791
|
+ }];
|
1781
|
1792
|
}
|
1782
|
1793
|
|
1783
|
1794
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteAudioFrameDecodedOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed {
|
|
@@ -1789,217 +1800,217 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
1789
|
1800
|
|
1790
|
1801
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstLocalVideoFrameWithSize:(CGSize)size elapsed:(NSInteger)elapsed {
|
1791
|
1802
|
[self sendEvent:AGFirstLocalVideoFrame params:@{
|
1792
|
|
- @"width": @(size.width),
|
1793
|
|
- @"height": @(size.height),
|
1794
|
|
- @"elapsed": @(elapsed)
|
1795
|
|
- }];
|
|
1803
|
+ @"width": @(size.width),
|
|
1804
|
+ @"height": @(size.height),
|
|
1805
|
+ @"elapsed": @(elapsed)
|
|
1806
|
+ }];
|
1796
|
1807
|
}
|
1797
|
1808
|
|
1798
|
1809
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed {
|
1799
|
1810
|
[self sendEvent:AGFirstRemoteVideoDecoded params:@{
|
1800
|
|
- @"uid": @(uid),
|
1801
|
|
- @"width": @(size.width),
|
1802
|
|
- @"height": @(size.height),
|
1803
|
|
- @"elapsed": @(elapsed)
|
1804
|
|
- }];
|
|
1811
|
+ @"uid": @(uid),
|
|
1812
|
+ @"width": @(size.width),
|
|
1813
|
+ @"height": @(size.height),
|
|
1814
|
+ @"elapsed": @(elapsed)
|
|
1815
|
+ }];
|
1805
|
1816
|
}
|
1806
|
1817
|
|
1807
|
1818
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed {
|
1808
|
1819
|
[self sendEvent:AGFirstRemoteVideoFrame params:@{
|
1809
|
|
- @"uid": @(uid),
|
1810
|
|
- @"width": @(size.width),
|
1811
|
|
- @"height": @(size.height),
|
1812
|
|
- @"elapsed": @(elapsed)}];
|
|
1820
|
+ @"uid": @(uid),
|
|
1821
|
+ @"width": @(size.width),
|
|
1822
|
+ @"height": @(size.height),
|
|
1823
|
+ @"elapsed": @(elapsed)}];
|
1813
|
1824
|
}
|
1814
|
1825
|
|
1815
|
1826
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioMuted:(BOOL)muted byUid:(NSUInteger)uid {
|
1816
|
1827
|
[self sendEvent:AGUserMuteAudio params:@{
|
1817
|
|
- @"muted": @(muted),
|
1818
|
|
- @"uid": @(uid)
|
1819
|
|
- }];
|
|
1828
|
+ @"muted": @(muted),
|
|
1829
|
+ @"uid": @(uid)
|
|
1830
|
+ }];
|
1820
|
1831
|
}
|
1821
|
1832
|
|
1822
|
1833
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoMuted:(BOOL)muted byUid:(NSUInteger)uid {
|
1823
|
1834
|
[self sendEvent:AGUserMuteVideo params:@{
|
1824
|
|
- @"muted": @(muted),
|
1825
|
|
- @"uid": @(uid)
|
1826
|
|
- }];
|
|
1835
|
+ @"muted": @(muted),
|
|
1836
|
+ @"uid": @(uid)
|
|
1837
|
+ }];
|
1827
|
1838
|
}
|
1828
|
1839
|
|
1829
|
1840
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid {
|
1830
|
1841
|
[self sendEvent:AGUserEnableVideo params:@{
|
1831
|
|
- @"enabled": @(enabled),
|
1832
|
|
- @"uid": @(uid)
|
1833
|
|
- }];
|
|
1842
|
+ @"enabled": @(enabled),
|
|
1843
|
+ @"uid": @(uid)
|
|
1844
|
+ }];
|
1834
|
1845
|
}
|
1835
|
1846
|
|
1836
|
1847
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLocalVideoEnabled:(BOOL)enabled byUid:(NSUInteger)uid {
|
1837
|
1848
|
[self sendEvent:AGUserEnableLocalVideo params:@{
|
1838
|
|
- @"enabled": @(enabled),
|
1839
|
|
- @"uid": @(uid)
|
1840
|
|
- }];
|
|
1849
|
+ @"enabled": @(enabled),
|
|
1850
|
+ @"uid": @(uid)
|
|
1851
|
+ }];
|
1841
|
1852
|
}
|
1842
|
1853
|
|
1843
|
1854
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation {
|
1844
|
1855
|
[self sendEvent:AGVideoSizeChanged params:@{
|
1845
|
|
- @"uid": @(uid),
|
1846
|
|
- @"width": @(size.width),
|
1847
|
|
- @"height": @(size.height),
|
1848
|
|
- @"rotation": @(rotation)
|
1849
|
|
- }];
|
|
1856
|
+ @"uid": @(uid),
|
|
1857
|
+ @"width": @(size.width),
|
|
1858
|
+ @"height": @(size.height),
|
|
1859
|
+ @"rotation": @(rotation)
|
|
1860
|
+ }];
|
1850
|
1861
|
}
|
1851
|
1862
|
|
1852
|
1863
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state {
|
1853
|
1864
|
[self sendEvent:AGRemoteVideoStateChanged params:@{
|
1854
|
|
- @"uid": @(uid),
|
1855
|
|
- @"state": @(state)
|
1856
|
|
- }];
|
|
1865
|
+ @"uid": @(uid),
|
|
1866
|
+ @"state": @(state)
|
|
1867
|
+ }];
|
1857
|
1868
|
}
|
1858
|
1869
|
|
1859
|
1870
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didLocalPublishFallbackToAudioOnly:(BOOL)isFallbackOrRecover {
|
1860
|
1871
|
[self sendEvent:AGLocalPublishFallbackToAudioOnly params:@{
|
1861
|
|
- @"isFallbackOrRecover": @(isFallbackOrRecover)
|
1862
|
|
- }];
|
|
1872
|
+ @"isFallbackOrRecover": @(isFallbackOrRecover)
|
|
1873
|
+ }];
|
1863
|
1874
|
}
|
1864
|
1875
|
|
1865
|
1876
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didRemoteSubscribeFallbackToAudioOnly:(BOOL)isFallbackOrRecover byUid:(NSUInteger)uid {
|
1866
|
1877
|
[self sendEvent:AGRemoteSubscribeFallbackToAudioOnly params:@{
|
1867
|
|
- @"isFallbackOrRecover": @(isFallbackOrRecover),
|
1868
|
|
- @"uid": @(uid)
|
1869
|
|
- }];
|
|
1878
|
+ @"isFallbackOrRecover": @(isFallbackOrRecover),
|
|
1879
|
+ @"uid": @(uid)
|
|
1880
|
+ }];
|
1870
|
1881
|
}
|
1871
|
1882
|
|
1872
|
1883
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didAudioRouteChanged:(AgoraAudioOutputRouting)routing {
|
1873
|
1884
|
[self sendEvent:AGAudioRouteChanged params:@{
|
1874
|
|
- @"routing": @(routing)
|
1875
|
|
- }];
|
|
1885
|
+ @"routing": @(routing)
|
|
1886
|
+ }];
|
1876
|
1887
|
}
|
1877
|
1888
|
|
1878
|
1889
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine cameraFocusDidChangedToRect:(CGRect)rect {
|
1879
|
1890
|
[self sendEvent:AGCameraFocusAreaChanged params:@{
|
1880
|
|
- @"rect": @(rect)
|
1881
|
|
- }];
|
|
1891
|
+ @"rect": @(rect)
|
|
1892
|
+ }];
|
1882
|
1893
|
}
|
1883
|
1894
|
|
1884
|
1895
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine cameraExposureDidChangedToRect:(CGRect)rect {
|
1885
|
1896
|
[self sendEvent:AGCameraExposureAreaChanged params:@{
|
1886
|
|
- @"rect": @(rect)
|
1887
|
|
- }];
|
|
1897
|
+ @"rect": @(rect)
|
|
1898
|
+ }];
|
1888
|
1899
|
}
|
1889
|
1900
|
|
1890
|
1901
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine remoteAudioStats:(AgoraRtcRemoteAudioStats *_Nonnull)stats {
|
1891
|
1902
|
[self sendEvent:AGRemoteAudioStats params:@{
|
1892
|
|
- @"stats": @{
|
1893
|
|
- @"uid": @(stats.uid),
|
1894
|
|
- @"quality": @(stats.quality),
|
1895
|
|
- @"networkTransportDelay": @(stats.networkTransportDelay),
|
1896
|
|
- @"jitterBufferDelay": @(stats.jitterBufferDelay),
|
1897
|
|
- @"audioLossRate": @(stats.audioLossRate)
|
1898
|
|
- }
|
1899
|
|
- }];
|
|
1903
|
+ @"stats": @{
|
|
1904
|
+ @"uid": @(stats.uid),
|
|
1905
|
+ @"quality": @(stats.quality),
|
|
1906
|
+ @"networkTransportDelay": @(stats.networkTransportDelay),
|
|
1907
|
+ @"jitterBufferDelay": @(stats.jitterBufferDelay),
|
|
1908
|
+ @"audioLossRate": @(stats.audioLossRate)
|
|
1909
|
+ }
|
|
1910
|
+ }];
|
1900
|
1911
|
}
|
1901
|
1912
|
|
1902
|
1913
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine reportRtcStats:(AgoraChannelStats *_Nonnull)stats {
|
1903
|
1914
|
[self sendEvent:AGRtcStats params:@{
|
1904
|
|
- @"stats": @{
|
1905
|
|
- @"duration": @(stats.duration),
|
1906
|
|
- @"txPacketLossRate": @(stats.txPacketLossRate),
|
1907
|
|
- @"rxPacketLossRate": @(stats.rxPacketLossRate),
|
1908
|
|
- @"txBytes": @(stats.txBytes),
|
1909
|
|
- @"rxBytes": @(stats.rxBytes),
|
1910
|
|
- @"txAudioKBitrate": @(stats.txAudioKBitrate),
|
1911
|
|
- @"rxAudioKBitrate": @(stats.rxAudioKBitrate),
|
1912
|
|
- @"txVideoKBitrate": @(stats.txVideoKBitrate),
|
1913
|
|
- @"rxVideoKBitrate": @(stats.rxVideoKBitrate),
|
1914
|
|
- @"lastmileDelay": @(stats.lastmileDelay),
|
1915
|
|
- @"userCount": @(stats.userCount),
|
1916
|
|
- @"cpuAppUsage": @(stats.cpuAppUsage),
|
1917
|
|
- @"cpuTotalUsage": @(stats.cpuTotalUsage)
|
1918
|
|
- }
|
1919
|
|
- }];
|
|
1915
|
+ @"stats": @{
|
|
1916
|
+ @"duration": @(stats.duration),
|
|
1917
|
+ @"txPacketLossRate": @(stats.txPacketLossRate),
|
|
1918
|
+ @"rxPacketLossRate": @(stats.rxPacketLossRate),
|
|
1919
|
+ @"txBytes": @(stats.txBytes),
|
|
1920
|
+ @"rxBytes": @(stats.rxBytes),
|
|
1921
|
+ @"txAudioKBitrate": @(stats.txAudioKBitrate),
|
|
1922
|
+ @"rxAudioKBitrate": @(stats.rxAudioKBitrate),
|
|
1923
|
+ @"txVideoKBitrate": @(stats.txVideoKBitrate),
|
|
1924
|
+ @"rxVideoKBitrate": @(stats.rxVideoKBitrate),
|
|
1925
|
+ @"lastmileDelay": @(stats.lastmileDelay),
|
|
1926
|
+ @"userCount": @(stats.userCount),
|
|
1927
|
+ @"cpuAppUsage": @(stats.cpuAppUsage),
|
|
1928
|
+ @"cpuTotalUsage": @(stats.cpuTotalUsage)
|
|
1929
|
+ }
|
|
1930
|
+ }];
|
1920
|
1931
|
}
|
1921
|
1932
|
|
1922
|
1933
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine lastmileQuality:(AgoraNetworkQuality)quality {
|
1923
|
1934
|
[self sendEvent:AGLastmileQuality params:@{
|
1924
|
|
- @"quality": @(quality)
|
1925
|
|
- }];
|
|
1935
|
+ @"quality": @(quality)
|
|
1936
|
+ }];
|
1926
|
1937
|
}
|
1927
|
1938
|
|
1928
|
1939
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine networkQuality:(NSUInteger)uid txQuality:(AgoraNetworkQuality)txQuality rxQuality:(AgoraNetworkQuality)rxQuality {
|
1929
|
1940
|
[self sendEvent:AGNetworkQuality params:@{
|
1930
|
|
- @"uid": @(uid),
|
1931
|
|
- @"txQuality": @(txQuality),
|
1932
|
|
- @"rxQuality": @(rxQuality)
|
1933
|
|
- }];
|
|
1941
|
+ @"uid": @(uid),
|
|
1942
|
+ @"txQuality": @(txQuality),
|
|
1943
|
+ @"rxQuality": @(rxQuality)
|
|
1944
|
+ }];
|
1934
|
1945
|
}
|
1935
|
1946
|
|
1936
|
1947
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localVideoStats:(AgoraRtcLocalVideoStats *_Nonnull)stats {
|
1937
|
1948
|
[self sendEvent:AGLocalVideoStats params:@{
|
1938
|
|
- @"stats": @{
|
1939
|
|
- @"sentBitrate": @(stats.sentBitrate),
|
1940
|
|
- @"sentFrameRate": @(stats.sentFrameRate)
|
1941
|
|
- },
|
1942
|
|
- @"encoderOutputFrameRate": @(stats.encoderOutputFrameRate),
|
1943
|
|
- @"rendererOutputFrameRate":
|
|
1949
|
+ @"stats": @{
|
|
1950
|
+ @"sentBitrate": @(stats.sentBitrate),
|
|
1951
|
+ @"sentFrameRate": @(stats.sentFrameRate)
|
|
1952
|
+ },
|
|
1953
|
+ @"encoderOutputFrameRate": @(stats.encoderOutputFrameRate),
|
|
1954
|
+ @"rendererOutputFrameRate":
|
1944
|
1955
|
@(stats.rendererOutputFrameRate)
|
1945
|
|
- }];
|
|
1956
|
+ }];
|
1946
|
1957
|
}
|
1947
|
1958
|
|
1948
|
1959
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine remoteVideoStats:(AgoraRtcRemoteVideoStats *_Nonnull)stats {
|
1949
|
1960
|
[self sendEvent:AGRemoteVideoStats params:@{
|
1950
|
|
- @"stats": @{
|
1951
|
|
- @"uid": @(stats.uid),
|
1952
|
|
- @"width": @(stats.width),
|
1953
|
|
- @"height": @(stats.height),
|
1954
|
|
- @"receivedBitrate": @(stats.receivedBitrate),
|
1955
|
|
- @"rendererOutputFrameRate": @(stats.rendererOutputFrameRate),
|
1956
|
|
- @"rxStreamType": @(stats.rxStreamType),
|
1957
|
|
- @"decoderOutputFrameRate": @(stats.decoderOutputFrameRate)
|
1958
|
|
- }
|
1959
|
|
- }];
|
|
1961
|
+ @"stats": @{
|
|
1962
|
+ @"uid": @(stats.uid),
|
|
1963
|
+ @"width": @(stats.width),
|
|
1964
|
+ @"height": @(stats.height),
|
|
1965
|
+ @"receivedBitrate": @(stats.receivedBitrate),
|
|
1966
|
+ @"rendererOutputFrameRate": @(stats.rendererOutputFrameRate),
|
|
1967
|
+ @"rxStreamType": @(stats.rxStreamType),
|
|
1968
|
+ @"decoderOutputFrameRate": @(stats.decoderOutputFrameRate)
|
|
1969
|
+ }
|
|
1970
|
+ }];
|
1960
|
1971
|
}
|
1961
|
1972
|
|
1962
|
1973
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine audioTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate {
|
1963
|
1974
|
[self sendEvent:AGAudioTransportStatsOfUid params:@{
|
1964
|
|
- @"uid": @(uid),
|
1965
|
|
- @"delay": @(delay),
|
1966
|
|
- @"lost": @(lost),
|
1967
|
|
- @"rxKBitrate": @(rxKBitRate)
|
1968
|
|
- }];
|
|
1975
|
+ @"uid": @(uid),
|
|
1976
|
+ @"delay": @(delay),
|
|
1977
|
+ @"lost": @(lost),
|
|
1978
|
+ @"rxKBitrate": @(rxKBitRate)
|
|
1979
|
+ }];
|
1969
|
1980
|
}
|
1970
|
1981
|
|
1971
|
1982
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine videoTransportStatsOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost rxKBitRate:(NSUInteger)rxKBitRate {
|
1972
|
1983
|
[self sendEvent:AGVideoTransportStatsOfUid params:@{
|
1973
|
|
- @"uid": @(uid),
|
1974
|
|
- @"delay": @(delay),
|
1975
|
|
- @"lost": @(lost),
|
1976
|
|
- @"rxKBitrate": @(rxKBitRate)
|
1977
|
|
- }];
|
|
1984
|
+ @"uid": @(uid),
|
|
1985
|
+ @"delay": @(delay),
|
|
1986
|
+ @"lost": @(lost),
|
|
1987
|
+ @"rxKBitrate": @(rxKBitRate)
|
|
1988
|
+ }];
|
1978
|
1989
|
}
|
1979
|
1990
|
|
1980
|
1991
|
- (void)rtcEngineRemoteAudioMixingDidStart:(AgoraRtcEngineKit *_Nonnull)engine {
|
1981
|
1992
|
[self sendEvent:AGRemoteAudioMixingStart params:@{
|
1982
|
|
- @"message": @"RemoteAudioMixingStarted"
|
1983
|
|
- }];
|
|
1993
|
+ @"message": @"RemoteAudioMixingStarted"
|
|
1994
|
+ }];
|
1984
|
1995
|
}
|
1985
|
1996
|
|
1986
|
1997
|
- (void)rtcEngineRemoteAudioMixingDidFinish:(AgoraRtcEngineKit *_Nonnull)engine {
|
1987
|
1998
|
[self sendEvent:AGRemoteAudioMixingFinish params:@{
|
1988
|
|
- @"message": @"RemoteAudioMixingFinish"
|
1989
|
|
- }];
|
|
1999
|
+ @"message": @"RemoteAudioMixingFinish"
|
|
2000
|
+ }];
|
1990
|
2001
|
}
|
1991
|
2002
|
|
1992
|
2003
|
- (void)rtcEngineDidAudioEffectFinish:(AgoraRtcEngineKit *_Nonnull)engine soundId:(NSInteger)soundId {
|
1993
|
2004
|
[self sendEvent:AGAudioEffectFinish params:@{
|
1994
|
|
- @"soundid": @(soundId)
|
1995
|
|
- }];
|
|
2005
|
+ @"soundid": @(soundId)
|
|
2006
|
+ }];
|
1996
|
2007
|
}
|
1997
|
2008
|
|
1998
|
2009
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamPublishedWithUrl:(NSString *_Nonnull)url errorCode:(AgoraErrorCode)errorCode {
|
1999
|
2010
|
[self sendEvent:AGStreamPublished params:@{
|
2000
|
|
- @"url": url,
|
2001
|
|
- @"code": @(errorCode)
|
2002
|
|
- }];
|
|
2011
|
+ @"url": url,
|
|
2012
|
+ @"code": @(errorCode)
|
|
2013
|
+ }];
|
2003
|
2014
|
}
|
2004
|
2015
|
|
2005
|
2016
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine rtmpStreamingChangedToState:(NSString *_Nonnull)url state:(AgoraRtmpStreamingState)state errorCode:(AgoraRtmpStreamingErrorCode)errorCode {
|
|
@@ -2012,14 +2023,14 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
2012
|
2023
|
|
2013
|
2024
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamUnpublishedWithUrl:(NSString *_Nonnull)url {
|
2014
|
2025
|
[self sendEvent:AGStreamUnpublish params:@{
|
2015
|
|
- @"url": url,
|
2016
|
|
- }];
|
|
2026
|
+ @"url": url,
|
|
2027
|
+ }];
|
2017
|
2028
|
}
|
2018
|
2029
|
|
2019
|
2030
|
- (void)rtcEngineTranscodingUpdated:(AgoraRtcEngineKit *_Nonnull)engine {
|
2020
|
2031
|
[self sendEvent:AGTranscodingUpdate params:@{
|
2021
|
|
- @"message": @"AGTranscodingUpdate"
|
2022
|
|
- }];
|
|
2032
|
+ @"message": @"AGTranscodingUpdate"
|
|
2033
|
+ }];
|
2023
|
2034
|
}
|
2024
|
2035
|
|
2025
|
2036
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localVideoStateChange:(AgoraLocalVideoStreamState)state error:(AgoraLocalVideoStreamError)error {
|
|
@@ -2031,10 +2042,10 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
2031
|
2042
|
|
2032
|
2043
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine streamInjectedStatusOfUrl:(NSString *_Nonnull)url uid:(NSUInteger)uid status:(AgoraInjectStreamStatus)status {
|
2033
|
2044
|
[self sendEvent:AGStreamInjectedStatus params:@{
|
2034
|
|
- @"uid": @(uid),
|
2035
|
|
- @"url": url,
|
2036
|
|
- @"status": @(status)
|
2037
|
|
- }];
|
|
2045
|
+ @"uid": @(uid),
|
|
2046
|
+ @"url": url,
|
|
2047
|
+ @"status": @(status)
|
|
2048
|
+ }];
|
2038
|
2049
|
}
|
2039
|
2050
|
|
2040
|
2051
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData *_Nonnull)data {
|
|
@@ -2047,24 +2058,24 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
2047
|
2058
|
|
2048
|
2059
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached {
|
2049
|
2060
|
[self sendEvent:AGOccurStreamMessageError params:@{
|
2050
|
|
- @"uid": @(uid),
|
2051
|
|
- @"streamId": @(streamId),
|
2052
|
|
- @"error": @(error),
|
2053
|
|
- @"missed": @(missed),
|
2054
|
|
- @"cached": @(cached)
|
2055
|
|
- }];
|
|
2061
|
+ @"uid": @(uid),
|
|
2062
|
+ @"streamId": @(streamId),
|
|
2063
|
+ @"error": @(error),
|
|
2064
|
+ @"missed": @(missed),
|
|
2065
|
+ @"cached": @(cached)
|
|
2066
|
+ }];
|
2056
|
2067
|
}
|
2057
|
2068
|
|
2058
|
2069
|
- (void)rtcEngineMediaEngineDidLoaded:(AgoraRtcEngineKit *_Nonnull)engine {
|
2059
|
2070
|
[self sendEvent:AGMediaEngineLoaded params:@{
|
2060
|
|
- @"message": @"MediaEngineLoaded"
|
2061
|
|
- }];
|
|
2071
|
+ @"message": @"MediaEngineLoaded"
|
|
2072
|
+ }];
|
2062
|
2073
|
}
|
2063
|
2074
|
|
2064
|
2075
|
- (void)rtcEngineMediaEngineDidStartCall:(AgoraRtcEngineKit *_Nonnull)engine {
|
2065
|
2076
|
[self sendEvent:AGMediaEngineStartCall params:@{
|
2066
|
|
- @"message": @"AGMediaEngineStartCall"
|
2067
|
|
- }];
|
|
2077
|
+ @"message": @"AGMediaEngineStartCall"
|
|
2078
|
+ }];
|
2068
|
2079
|
}
|
2069
|
2080
|
|
2070
|
2081
|
- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localAudioMixingStateDidChanged:(AgoraAudioMixingStateCode)state errorCode:(AgoraAudioMixingErrorCode)errorCode {
|
|
@@ -2095,4 +2106,4 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
|
2095
|
2106
|
}];
|
2096
|
2107
|
}
|
2097
|
2108
|
|
2098
|
|
-@end
|
|
2109
|
+@end
|