|
@@ -177,6 +177,24 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
|
177
|
177
|
[self.rtcEngine enableAudio];
|
178
|
178
|
}
|
179
|
179
|
|
|
180
|
+ if ([options objectForKey:@"beauty"]) {
|
|
181
|
+ AgoraBeautyOptions *beautyOption = [[AgoraBeautyOptions alloc] init];
|
|
182
|
+ beautyOption.lighteningContrastLevel = [options[@"beauty"][@"lighteningContrastLevel"] integerValue];
|
|
183
|
+ beautyOption.lighteningLevel = [options[@"beauty"][@"lighteningLevel"] floatValue];
|
|
184
|
+ beautyOption.smoothnessLevel = [options[@"beauty"][@"smoothnessLevel"] floatValue];
|
|
185
|
+ beautyOption.rednessLevel = [options[@"beauty"][@"rednessLevel"] floatValue];
|
|
186
|
+ [self.rtcEngine setBeautyEffectOptions:true options:beautyOption];
|
|
187
|
+ }
|
|
188
|
+ if ([options objectForKey:@"voice"]) {
|
|
189
|
+ NSInteger voiceValue = [options[@"voice"][@"value"] integerValue];
|
|
190
|
+ NSString *voiceType = options[@"voice"][@"type"];
|
|
191
|
+ if ([voiceType isEqualToString: @"changer"]) {
|
|
192
|
+ [self.rtcEngine setLocalVoiceChanger:(AgoraAudioVoiceChanger)voiceValue];
|
|
193
|
+ }
|
|
194
|
+ if ([voiceType isEqualToString: @"reverbPreset"]) {
|
|
195
|
+ [self.rtcEngine setLocalVoiceReverbPreset:(AgoraAudioReverbPreset)voiceValue];
|
|
196
|
+ }
|
|
197
|
+ }
|
180
|
198
|
if (options[@"secret"] != nil) {
|
181
|
199
|
[self.rtcEngine setEncryptionSecret:[options[@"secret"] stringValue]];
|
182
|
200
|
if (options[@"secretMode"] != nil) {
|
|
@@ -184,7 +202,7 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
|
184
|
202
|
}
|
185
|
203
|
}
|
186
|
204
|
|
187
|
|
- AgoraVideoEncoderConfiguration *video_encoder_config = [[AgoraVideoEncoderConfiguration new] initWithWidth:[options[@"videoEncoderConfig"][@"width"] integerValue] height:[options[@"videoEncoderConfig"][@"height"] integerValue] frameRate:(AgoraVideoFrameRate)[options[@"videoEncoderConfig"][@"frameRate"] integerValue] bitrate:[options[@"videoEncoderConfig"][@"bitrate"] integerValue] orientationMode: (AgoraVideoOutputOrientationMode)[options[@"videoEncoderConfig"][@"orientationMode"] integerValue]];
|
|
205
|
+ 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]];
|
188
|
206
|
[self.rtcEngine setVideoEncoderConfiguration:video_encoder_config];
|
189
|
207
|
[self.rtcEngine setClientRole:(AgoraClientRole)[options[@"clientRole"] integerValue]];
|
190
|
208
|
[self.rtcEngine setAudioProfile:(AgoraAudioProfile)[options[@"audioProfile"] integerValue]
|
|
@@ -431,19 +449,41 @@ RCT_EXPORT_METHOD(enableAudioVolumeIndication: (NSInteger) interval smooth:(NSIn
|
431
|
449
|
[self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth];
|
432
|
450
|
}
|
433
|
451
|
|
434
|
|
-// create data stream
|
435
|
|
-RCT_EXPORT_METHOD(createDataStream
|
|
452
|
+RCT_EXPORT_METHOD(sendMessage
|
436
|
453
|
:(NSDictionary *)options
|
437
|
454
|
resolve:(RCTPromiseResolveBlock)resolve
|
438
|
455
|
reject:(RCTPromiseRejectBlock)reject) {
|
439
|
|
- NSInteger streamId = 0;
|
440
|
|
- if (options[@"streamId"] != nil) {
|
441
|
|
- streamId = [options[@"streamId"] integerValue];
|
|
456
|
+ NSInteger uid = 0;
|
|
457
|
+ if (options[@"streamID"] != nil) {
|
|
458
|
+ uid = [options[@"streamID"] integerValue];
|
|
459
|
+ }
|
|
460
|
+ NSInteger streamID = [self.rtcEngine createDataStream:&uid reliable:[options[@"reliable"] boolValue] ordered:[options[@"ordered"] boolValue]];
|
|
461
|
+ if (streamID < 0) {
|
|
462
|
+ reject(@"131001", @"createDataStream failed", [self makeNSError:@{
|
|
463
|
+ @"code": @(131001),
|
|
464
|
+ @"message":@{
|
|
465
|
+ @"success": @(NO),
|
|
466
|
+ @"value":[NSNumber numberWithInteger:uid]
|
|
467
|
+ }
|
|
468
|
+ }]);
|
|
469
|
+ }
|
|
470
|
+ NSString *dataStr = options[@"data"];
|
|
471
|
+ NSData *data = [dataStr dataUsingEncoding:NSUTF8StringEncoding];
|
|
472
|
+ NSInteger res = [self.rtcEngine sendStreamMessage:uid data:data];
|
|
473
|
+ if (res == 0) {
|
|
474
|
+ resolve(@{@"success": @(YES), @"streamID": @(uid)});
|
|
475
|
+ } else {
|
|
476
|
+ reject(@"131001", @"sendStreamMessage failed", [self makeNSError:@{
|
|
477
|
+ @"code": @(131001),
|
|
478
|
+ @"message":@{
|
|
479
|
+ @"success": @(NO),
|
|
480
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
481
|
+ }
|
|
482
|
+ }]);
|
442
|
483
|
}
|
443
|
|
- [self.rtcEngine createDataStream:streamId reliable:[options[@"reliable"] boolValue] ordered:[options[@"ordered"] boolValue]];
|
444
|
|
- resolve(@[[NSNumber numberWithInteger:streamId]]);
|
445
|
484
|
}
|
446
|
485
|
|
|
486
|
+
|
447
|
487
|
// is speaker phone enabled
|
448
|
488
|
RCT_EXPORT_METHOD(methodisSpeakerphoneEnabled:(RCTResponseSenderBlock)callback) {
|
449
|
489
|
callback(@[@{@"status": @([self.rtcEngine isSpeakerphoneEnabled])}]);
|
|
@@ -971,32 +1011,33 @@ RCT_EXPORT_METHOD(setAudioSessionOperationRestriction
|
971
|
1011
|
[self.rtcEngine setAudioSessionOperationRestriction:restrictionType];
|
972
|
1012
|
}
|
973
|
1013
|
|
|
1014
|
+// deprecated
|
974
|
1015
|
// gateway test start echo
|
975
|
|
-RCT_EXPORT_METHOD(startEchoTest
|
976
|
|
- :(RCTPromiseResolveBlock)resolve
|
977
|
|
- reject:(RCTPromiseRejectBlock)reject) {
|
978
|
|
- NSInteger res = [self.rtcEngine startEchoTest:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
|
979
|
|
- _block(@{
|
980
|
|
- @"channel": channel,
|
981
|
|
- @"uid": @(uid),
|
982
|
|
- @"elapsed": @(elapsed)
|
983
|
|
- });
|
984
|
|
- }];
|
985
|
|
- if (res != 0) {
|
986
|
|
- reject(@"131019", @"startEchoTest failed", [self makeNSError:@{
|
987
|
|
- @"code": @(131019),
|
988
|
|
- @"message":@{
|
989
|
|
- @"success": @(NO),
|
990
|
|
- @"value":@(res)
|
991
|
|
- }
|
992
|
|
- }]);
|
993
|
|
- } else {
|
994
|
|
- resolve(@{
|
995
|
|
- @"success": @(YES),
|
996
|
|
- @"value": @(res)
|
997
|
|
- });
|
998
|
|
- }
|
999
|
|
-}
|
|
1016
|
+//RCT_EXPORT_METHOD(startEchoTest
|
|
1017
|
+// :(RCTPromiseResolveBlock)resolve
|
|
1018
|
+// reject:(RCTPromiseRejectBlock)reject) {
|
|
1019
|
+// NSInteger res = [self.rtcEngine startEchoTest:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
|
|
1020
|
+// _block(@{
|
|
1021
|
+// @"channel": channel,
|
|
1022
|
+// @"uid": @(uid),
|
|
1023
|
+// @"elapsed": @(elapsed)
|
|
1024
|
+// });
|
|
1025
|
+// }];
|
|
1026
|
+// if (res != 0) {
|
|
1027
|
+// reject(@"131019", @"startEchoTest failed", [self makeNSError:@{
|
|
1028
|
+// @"code": @(131019),
|
|
1029
|
+// @"message":@{
|
|
1030
|
+// @"success": @(NO),
|
|
1031
|
+// @"value":@(res)
|
|
1032
|
+// }
|
|
1033
|
+// }]);
|
|
1034
|
+// } else {
|
|
1035
|
+// resolve(@{
|
|
1036
|
+// @"success": @(YES),
|
|
1037
|
+// @"value": @(res)
|
|
1038
|
+// });
|
|
1039
|
+// }
|
|
1040
|
+//}
|
1000
|
1041
|
|
1001
|
1042
|
// gateway test stop echo
|
1002
|
1043
|
RCT_EXPORT_METHOD(stopEchoTest
|
|
@@ -1346,24 +1387,25 @@ RCT_EXPORT_METHOD(removeInjectStreamUrl
|
1346
|
1387
|
}
|
1347
|
1388
|
}
|
1348
|
1389
|
|
|
1390
|
+// deprecated
|
1349
|
1391
|
// set video quality
|
1350
|
|
-RCT_EXPORT_METHOD(setVideoQualityParameters
|
1351
|
|
- :(BOOL) quality
|
1352
|
|
- resolve:(RCTPromiseResolveBlock)resolve
|
1353
|
|
- reject:(RCTPromiseRejectBlock)reject) {
|
1354
|
|
- NSInteger res = [self.rtcEngine setVideoQualityParameters:quality];
|
1355
|
|
- if (res == 0) {
|
1356
|
|
- resolve(@{@"success": @(YES)});
|
1357
|
|
- } else {
|
1358
|
|
- reject(@"131033", @"setVideoQualityParameters failed", [self makeNSError:@{
|
1359
|
|
- @"code": @(131033),
|
1360
|
|
- @"message":@{
|
1361
|
|
- @"success": @(NO),
|
1362
|
|
- @"value":[NSNumber numberWithInteger:res]
|
1363
|
|
- }
|
1364
|
|
- }]);
|
1365
|
|
- }
|
1366
|
|
-}
|
|
1392
|
+//RCT_EXPORT_METHOD(setVideoQualityParameters
|
|
1393
|
+// :(BOOL) quality
|
|
1394
|
+// resolve:(RCTPromiseResolveBlock)resolve
|
|
1395
|
+// reject:(RCTPromiseRejectBlock)reject) {
|
|
1396
|
+// NSInteger res = [self.rtcEngine setVideoQualityParameters:quality];
|
|
1397
|
+// if (res == 0) {
|
|
1398
|
+// resolve(@{@"success": @(YES)});
|
|
1399
|
+// } else {
|
|
1400
|
+// reject(@"131033", @"setVideoQualityParameters failed", [self makeNSError:@{
|
|
1401
|
+// @"code": @(131033),
|
|
1402
|
+// @"message":@{
|
|
1403
|
+// @"success": @(NO),
|
|
1404
|
+// @"value":[NSNumber numberWithInteger:res]
|
|
1405
|
+// }
|
|
1406
|
+// }]);
|
|
1407
|
+// }
|
|
1408
|
+//}
|
1367
|
1409
|
|
1368
|
1410
|
// set local video mirror mode
|
1369
|
1411
|
RCT_EXPORT_METHOD(setLocalVideoMirrorMode
|
|
@@ -1532,10 +1574,27 @@ RCT_EXPORT_METHOD(getCallId
|
1532
|
1574
|
// setLogFile and setLogFilter
|
1533
|
1575
|
RCT_EXPORT_METHOD(setLog
|
1534
|
1576
|
:(NSString *)filePath
|
1535
|
|
- level:(NSUInteger)level
|
|
1577
|
+ level:(NSUInteger)level
|
|
1578
|
+ size:(NSUInteger)size
|
1536
|
1579
|
resolve:(RCTPromiseResolveBlock)resolve
|
1537
|
1580
|
reject:(RCTPromiseRejectBlock)reject) {
|
1538
|
|
- int res = [self.rtcEngine setLogFilter:level];
|
|
1581
|
+ int res = [self.rtcEngine setLogFileSize:size];
|
|
1582
|
+ if (res != 0) {
|
|
1583
|
+ reject(@"131036", @"setLogFileSize failed", [self makeNSError:@{
|
|
1584
|
+ @"code": @(131036),
|
|
1585
|
+ @"message":@{
|
|
1586
|
+ @"success": @(NO),
|
|
1587
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1588
|
+ }
|
|
1589
|
+ }]);
|
|
1590
|
+ } else {
|
|
1591
|
+ resolve(@{
|
|
1592
|
+ @"success": @(YES),
|
|
1593
|
+ @"value": @(res)
|
|
1594
|
+ });
|
|
1595
|
+ }
|
|
1596
|
+
|
|
1597
|
+ res = [self.rtcEngine setLogFilter:level];
|
1539
|
1598
|
if (res != 0) {
|
1540
|
1599
|
reject(@"131036", @"setLogFilter failed", [self makeNSError:@{
|
1541
|
1600
|
@"code": @(131036),
|
|
@@ -1567,26 +1626,6 @@ RCT_EXPORT_METHOD(setLog
|
1567
|
1626
|
}
|
1568
|
1627
|
}
|
1569
|
1628
|
|
1570
|
|
-// set
|
1571
|
|
-
|
1572
|
|
-// send stream message
|
1573
|
|
-RCT_EXPORT_METHOD(sendStreamMessage:(NSInteger)streamId data:(NSData*)data
|
1574
|
|
- resolve:(RCTPromiseResolveBlock)resolve
|
1575
|
|
- reject:(RCTPromiseRejectBlock)reject) {
|
1576
|
|
- NSInteger res = [self.rtcEngine sendStreamMessage:(streamId) data:data];
|
1577
|
|
- if (res == 0) {
|
1578
|
|
- resolve(@{@"success": @(YES)});
|
1579
|
|
- } else {
|
1580
|
|
- reject(@"131001", @"sendStreamMessage failed", [self makeNSError:@{
|
1581
|
|
- @"code": @(131001),
|
1582
|
|
- @"message":@{
|
1583
|
|
- @"success": @(NO),
|
1584
|
|
- @"value":[NSNumber numberWithInteger:res]
|
1585
|
|
- }
|
1586
|
|
- }]);
|
1587
|
|
- }
|
1588
|
|
-}
|
1589
|
|
-
|
1590
|
1629
|
// get sdk version
|
1591
|
1630
|
RCT_EXPORT_METHOD(getSdkVersion
|
1592
|
1631
|
:(RCTPromiseResolveBlock) resolve
|
|
@@ -1675,6 +1714,210 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options) {
|
1675
|
1714
|
[self.rtcEngine setLiveTranscoding:transcoding];
|
1676
|
1715
|
}
|
1677
|
1716
|
|
|
1717
|
+RCT_EXPORT_METHOD(setBeautyEffectOptions:(bool) enabled
|
|
1718
|
+ options:(NSDictionary *)options
|
|
1719
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1720
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1721
|
+ int res = [self.rtcEngine setBeautyEffectOptions:enabled options:options];
|
|
1722
|
+ if (res != 0) {
|
|
1723
|
+ reject(@"131037", @"setBeautyEffectOptions failed", [self makeNSError:@{
|
|
1724
|
+ @"code": @(131037),
|
|
1725
|
+ @"message":@{
|
|
1726
|
+ @"success": @(NO),
|
|
1727
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1728
|
+ }
|
|
1729
|
+ }]);
|
|
1730
|
+ } else {
|
|
1731
|
+ resolve(@{
|
|
1732
|
+ @"success": @(YES),
|
|
1733
|
+ @"value": @(res)
|
|
1734
|
+ });
|
|
1735
|
+ }
|
|
1736
|
+}
|
|
1737
|
+
|
|
1738
|
+RCT_EXPORT_METHOD(setLocalVoiceChanger:(NSInteger) voiceChanger
|
|
1739
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1740
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1741
|
+ int res = [self.rtcEngine setLocalVoiceChanger:(AgoraAudioVoiceChanger)voiceChanger];
|
|
1742
|
+ if (res != 0) {
|
|
1743
|
+ reject(@"131037", @"setBeautyEffectOptions failed", [self makeNSError:@{
|
|
1744
|
+ @"code": @(131037),
|
|
1745
|
+ @"message":@{
|
|
1746
|
+ @"success": @(NO),
|
|
1747
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1748
|
+ }
|
|
1749
|
+ }]);
|
|
1750
|
+ } else {
|
|
1751
|
+ resolve(@{
|
|
1752
|
+ @"success": @(YES),
|
|
1753
|
+ @"value": @(res)
|
|
1754
|
+ });
|
|
1755
|
+ }
|
|
1756
|
+}
|
|
1757
|
+
|
|
1758
|
+RCT_EXPORT_METHOD(setLocalVoiceReverbPreset:(NSInteger) reverbPreset
|
|
1759
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1760
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1761
|
+ int res = [self.rtcEngine setLocalVoiceReverbPreset:(AgoraAudioReverbPreset)reverbPreset];
|
|
1762
|
+ if (res != 0) {
|
|
1763
|
+ reject(@"131037", @"setLocalVoiceReverbPreset failed", [self makeNSError:@{
|
|
1764
|
+ @"code": @(131037),
|
|
1765
|
+ @"message":@{
|
|
1766
|
+ @"success": @(NO),
|
|
1767
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1768
|
+ }
|
|
1769
|
+ }]);
|
|
1770
|
+ } else {
|
|
1771
|
+ resolve(@{
|
|
1772
|
+ @"success": @(YES),
|
|
1773
|
+ @"value": @(res)
|
|
1774
|
+ });
|
|
1775
|
+ }
|
|
1776
|
+}
|
|
1777
|
+
|
|
1778
|
+RCT_EXPORT_METHOD(enableSoundPositionIndication:(bool) enabled
|
|
1779
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1780
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1781
|
+ int res = [self.rtcEngine enableSoundPositionIndication:enabled];
|
|
1782
|
+ if (res != 0) {
|
|
1783
|
+ reject(@"131037", @"enableSoundPositionIndication failed", [self makeNSError:@{
|
|
1784
|
+ @"code": @(131037),
|
|
1785
|
+ @"message":@{
|
|
1786
|
+ @"success": @(NO),
|
|
1787
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1788
|
+ }
|
|
1789
|
+ }]);
|
|
1790
|
+ } else {
|
|
1791
|
+ resolve(@{
|
|
1792
|
+ @"success": @(YES),
|
|
1793
|
+ @"value": @(res)
|
|
1794
|
+ });
|
|
1795
|
+ }
|
|
1796
|
+}
|
|
1797
|
+
|
|
1798
|
+RCT_EXPORT_METHOD(setRemoteVoicePosition:(NSInteger) uid
|
|
1799
|
+ pan:(float)pan
|
|
1800
|
+ gain:(float)gain
|
|
1801
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1802
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1803
|
+ int res = [self.rtcEngine setRemoteVoicePosition:uid pan:pan gain: gain];
|
|
1804
|
+ if (res != 0) {
|
|
1805
|
+ reject(@"131037", @"setRemoteVoicePosition failed", [self makeNSError:@{
|
|
1806
|
+ @"code": @(131037),
|
|
1807
|
+ @"message":@{
|
|
1808
|
+ @"success": @(NO),
|
|
1809
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1810
|
+ }
|
|
1811
|
+ }]);
|
|
1812
|
+ } else {
|
|
1813
|
+ resolve(@{
|
|
1814
|
+ @"success": @(YES),
|
|
1815
|
+ @"value": @(res)
|
|
1816
|
+ });
|
|
1817
|
+ }
|
|
1818
|
+}
|
|
1819
|
+
|
|
1820
|
+RCT_EXPORT_METHOD(startLastmileProbeTest:(NSDictionary*)config
|
|
1821
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1822
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1823
|
+ AgoraLastmileProbeConfig* probeConfig = [[AgoraLastmileProbeConfig alloc] init];
|
|
1824
|
+ probeConfig.probeUplink = [config[@"probeUplink"] boolValue];
|
|
1825
|
+ probeConfig.probeDownlink = [config[@"probeDownlink"] boolValue];
|
|
1826
|
+ probeConfig.expectedUplinkBitrate = [config[@"expectedUplinkBitrate"] integerValue];
|
|
1827
|
+ probeConfig.expectedDownlinkBitrate = [config[@"expectedDownlinkBitrate"] integerValue];
|
|
1828
|
+
|
|
1829
|
+ int res = [self.rtcEngine startLastmileProbeTest:probeConfig];
|
|
1830
|
+ if (res != 0) {
|
|
1831
|
+ reject(@"131037", @"startLastmileProbeTest failed", [self makeNSError:@{
|
|
1832
|
+ @"code": @(131037),
|
|
1833
|
+ @"message":@{
|
|
1834
|
+ @"success": @(NO),
|
|
1835
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1836
|
+ }
|
|
1837
|
+ }]);
|
|
1838
|
+ } else {
|
|
1839
|
+ resolve(@{
|
|
1840
|
+ @"success": @(YES),
|
|
1841
|
+ @"value": @(res)
|
|
1842
|
+ });
|
|
1843
|
+ }
|
|
1844
|
+}
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+RCT_EXPORT_METHOD(setRemoteUserPriority:(NSUInteger)uid
|
|
1848
|
+ userPriority:(NSInteger)userPriority
|
|
1849
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1850
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1851
|
+
|
|
1852
|
+ int res = [self.rtcEngine setRemoteUserPriority:uid type:(AgoraUserPriority)userPriority];
|
|
1853
|
+ if (res != 0) {
|
|
1854
|
+ reject(@"131037", @"setRemoteUserPriority failed", [self makeNSError:@{
|
|
1855
|
+ @"code": @(131037),
|
|
1856
|
+ @"message":@{
|
|
1857
|
+ @"success": @(NO),
|
|
1858
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1859
|
+ }
|
|
1860
|
+ }]);
|
|
1861
|
+ } else {
|
|
1862
|
+ resolve(@{
|
|
1863
|
+ @"success": @(YES),
|
|
1864
|
+ @"value": @(res)
|
|
1865
|
+ });
|
|
1866
|
+ }
|
|
1867
|
+}
|
|
1868
|
+
|
|
1869
|
+RCT_EXPORT_METHOD(startEchoTestWithInterval:(NSInteger)interval
|
|
1870
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1871
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1872
|
+
|
|
1873
|
+ int res = [self.rtcEngine startEchoTestWithInterval:interval successBlock:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
|
|
1874
|
+ [self sendEvent:AGIntervalTest params:@{
|
|
1875
|
+ @"message": @"StartEchoTestWithInterval",
|
|
1876
|
+ @"channel": channel,
|
|
1877
|
+ @"uid": @(uid),
|
|
1878
|
+ @"elapsed": @(elapsed),
|
|
1879
|
+ }];
|
|
1880
|
+ }];
|
|
1881
|
+ if (res != 0) {
|
|
1882
|
+ reject(@"131037", @"startEchoTestWithInterval failed", [self makeNSError:@{
|
|
1883
|
+ @"code": @(131037),
|
|
1884
|
+ @"message":@{
|
|
1885
|
+ @"success": @(NO),
|
|
1886
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1887
|
+ }
|
|
1888
|
+ }]);
|
|
1889
|
+ } else {
|
|
1890
|
+ resolve(@{
|
|
1891
|
+ @"success": @(YES),
|
|
1892
|
+ @"value": @(res)
|
|
1893
|
+ });
|
|
1894
|
+ }
|
|
1895
|
+}
|
|
1896
|
+
|
|
1897
|
+RCT_EXPORT_METHOD(setCameraCapturerConfiguration:(NSDictionary *)config
|
|
1898
|
+ resolve:(RCTPromiseResolveBlock)resolve
|
|
1899
|
+ reject:(RCTPromiseRejectBlock)reject) {
|
|
1900
|
+
|
|
1901
|
+ AgoraCameraCapturerConfiguration* configuration = [[AgoraCameraCapturerConfiguration alloc] init];
|
|
1902
|
+ configuration.preference = [config[@"preference"] integerValue];
|
|
1903
|
+
|
|
1904
|
+ int res = [self.rtcEngine setCameraCapturerConfiguration:configuration];
|
|
1905
|
+ if (res != 0) {
|
|
1906
|
+ reject(@"131037", @"setCameraCapturerConfiguration failed", [self makeNSError:@{
|
|
1907
|
+ @"code": @(131037),
|
|
1908
|
+ @"message":@{
|
|
1909
|
+ @"success": @(NO),
|
|
1910
|
+ @"value":[NSNumber numberWithInteger:res]
|
|
1911
|
+ }
|
|
1912
|
+ }]);
|
|
1913
|
+ } else {
|
|
1914
|
+ resolve(@{
|
|
1915
|
+ @"success": @(YES),
|
|
1916
|
+ @"value": @(res)
|
|
1917
|
+ });
|
|
1918
|
+ }
|
|
1919
|
+}
|
|
1920
|
+
|
1678
|
1921
|
- (NSArray<NSString *> *)supportedEvents {
|
1679
|
1922
|
return @[
|
1680
|
1923
|
AGWarning,
|
|
@@ -1739,6 +1982,9 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options) {
|
1739
|
1982
|
|
1740
|
1983
|
AGMediaEngineLoaded,
|
1741
|
1984
|
AGMediaEngineStartCall,
|
|
1985
|
+ AGIntervalTest,
|
|
1986
|
+ AGAudioMixingStateChanged,
|
|
1987
|
+ AGLastmileProbeTestResult
|
1742
|
1988
|
];
|
1743
|
1989
|
}
|
1744
|
1990
|
|
|
@@ -2178,4 +2424,32 @@ RCT_EXPORT_METHOD(setLiveTranscoding:(NSDictionary *)options) {
|
2178
|
2424
|
}];
|
2179
|
2425
|
}
|
2180
|
2426
|
|
|
2427
|
+- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine localAudioMixingStateDidChanged:(AgoraAudioMixingStateCode)state errorCode:(AgoraAudioMixingErrorCode)errorCode {
|
|
2428
|
+ [self sendEvent:AGAudioMixingStateChanged params:@{
|
|
2429
|
+ @"message": @"AudioMixingStateChanged",
|
|
2430
|
+ @"state": @(state),
|
|
2431
|
+ @"errorCode": @(errorCode)
|
|
2432
|
+ }];
|
|
2433
|
+}
|
|
2434
|
+
|
|
2435
|
+- (void)rtcEngine:(AgoraRtcEngineKit *_Nonnull)engine lastmileProbeTestResult:(AgoraLastmileProbeResult *_Nonnull)result {
|
|
2436
|
+ [self sendEvent:AGLastmileProbeTestResult params:@{
|
|
2437
|
+ @"message":@"LastmileProbeTestResult",
|
|
2438
|
+ @"result": @{
|
|
2439
|
+ @"state": @(result.state),
|
|
2440
|
+ @"rtt": @(result.rtt),
|
|
2441
|
+ @"uplinkReport": @{
|
|
2442
|
+ @"packetLossRate": @(result.uplinkReport.packetLossRate),
|
|
2443
|
+ @"jitter": @(result.uplinkReport.jitter),
|
|
2444
|
+ @"availableBandwidth": @(result.uplinkReport.availableBandwidth),
|
|
2445
|
+ },
|
|
2446
|
+ @"downlinkReport": @{
|
|
2447
|
+ @"packetLossRate": @(result.downlinkReport.packetLossRate),
|
|
2448
|
+ @"jitter": @(result.downlinkReport.jitter),
|
|
2449
|
+ @"availableBandwidth": @(result.downlinkReport.availableBandwidth),
|
|
2450
|
+ }
|
|
2451
|
+ }
|
|
2452
|
+ }];
|
|
2453
|
+}
|
|
2454
|
+
|
2181
|
2455
|
@end
|