Browse Source

Merge pull request #102 from syanbo/feat/upgrade-2.9.1

feat. support ios & android 2.9.1
matrixbirds 5 years ago
parent
commit
dbacf962d4
No account linked to committer's email address

+ 3
- 0
CHANGELOG View File

1
 ## THE CHANGELOG
1
 ## THE CHANGELOG
2
 
2
 
3
+#### 2.9.1-alpha.1
4
+  - support 2.9.1 native sdk
5
+
3
 #### 2.9.0-alpha.3
6
 #### 2.9.0-alpha.3
4
   - hotfix ios compile error
7
   - hotfix ios compile error
5
 
8
 

+ 1
- 1
android/build.gradle View File

61
     def androidSupportVersion = rootProject.hasProperty("androidSupportVersion")  ? rootProject.androidSupportVersion : DEFAULT_ANDROID_SUPPORT_VERSION
61
     def androidSupportVersion = rootProject.hasProperty("androidSupportVersion")  ? rootProject.androidSupportVersion : DEFAULT_ANDROID_SUPPORT_VERSION
62
     // from internet
62
     // from internet
63
     implementation "com.android.support:appcompat-v7:$androidSupportVersion"
63
     implementation "com.android.support:appcompat-v7:$androidSupportVersion"
64
-    implementation "io.agora.rtc:full-sdk:2.9.0"
64
+    implementation "io.agora.rtc:full-sdk:2.9.1"
65
     // from node_modules
65
     // from node_modules
66
     implementation "com.facebook.react:react-native:+"
66
     implementation "com.facebook.react:react-native:+"
67
 }
67
 }

+ 4
- 2
android/src/main/java/com/syan/agora/AgoraManager.java View File

16
 import io.agora.rtc.IMetadataObserver;
16
 import io.agora.rtc.IMetadataObserver;
17
 import io.agora.rtc.IRtcEngineEventHandler;
17
 import io.agora.rtc.IRtcEngineEventHandler;
18
 import io.agora.rtc.RtcEngine;
18
 import io.agora.rtc.RtcEngine;
19
+import io.agora.rtc.RtcEngineEx;
19
 import io.agora.rtc.video.BeautyOptions;
20
 import io.agora.rtc.video.BeautyOptions;
20
 import io.agora.rtc.video.VideoCanvas;
21
 import io.agora.rtc.video.VideoCanvas;
21
 import io.agora.rtc.video.VideoEncoderConfiguration;
22
 import io.agora.rtc.video.VideoEncoderConfiguration;
31
 
32
 
32
     public static AgoraManager sAgoraManager;
33
     public static AgoraManager sAgoraManager;
33
 
34
 
34
-    public RtcEngine mRtcEngine;
35
+    public RtcEngineEx mRtcEngine;
35
 
36
 
36
     private Context context;
37
     private Context context;
37
 
38
 
102
         //create rtcEngine instance and setup rtcEngine eventHandler
103
         //create rtcEngine instance and setup rtcEngine eventHandler
103
         try {
104
         try {
104
             this.context = context;
105
             this.context = context;
105
-            this.mRtcEngine = RtcEngine.create(context, options.getString("appid"), mRtcEventHandler);
106
+            this.mRtcEngine = (RtcEngineEx) RtcEngineEx.create(context, options.getString("appid"), mRtcEventHandler);
107
+            this.mRtcEngine.setAppType(8);
106
             if (options.hasKey("secret") && null != options.getString("secret")) {
108
             if (options.hasKey("secret") && null != options.getString("secret")) {
107
                 mRtcEngine.setEncryptionSecret(options.getString("secret"));
109
                 mRtcEngine.setEncryptionSecret(options.getString("secret"));
108
                 if (options.hasKey("secretMode") && null != options.getString("secretMode")) {
110
                 if (options.hasKey("secretMode") && null != options.getString("secretMode")) {

+ 63
- 4
android/src/main/java/com/syan/agora/AgoraModule.java View File

28
 import io.agora.rtc.IMetadataObserver;
28
 import io.agora.rtc.IMetadataObserver;
29
 import io.agora.rtc.IRtcEngineEventHandler;
29
 import io.agora.rtc.IRtcEngineEventHandler;
30
 import io.agora.rtc.RtcEngine;
30
 import io.agora.rtc.RtcEngine;
31
+import io.agora.rtc.RtcEngineEx;
31
 import io.agora.rtc.internal.LastmileProbeConfig;
32
 import io.agora.rtc.internal.LastmileProbeConfig;
32
 import io.agora.rtc.live.LiveInjectStreamConfig;
33
 import io.agora.rtc.live.LiveInjectStreamConfig;
33
 import io.agora.rtc.live.LiveTranscoding;
34
 import io.agora.rtc.live.LiveTranscoding;
38
 import io.agora.rtc.video.ChannelMediaInfo;
39
 import io.agora.rtc.video.ChannelMediaInfo;
39
 import io.agora.rtc.video.ChannelMediaRelayConfiguration;
40
 import io.agora.rtc.video.ChannelMediaRelayConfiguration;
40
 import io.agora.rtc.video.VideoEncoderConfiguration;
41
 import io.agora.rtc.video.VideoEncoderConfiguration;
42
+import io.agora.rtc.video.WatermarkOptions;
41
 
43
 
42
 import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;
44
 import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;
43
 import static com.syan.agora.AgoraConst.*;
45
 import static com.syan.agora.AgoraConst.*;
506
                         WritableMap obj = Arguments.createMap();
508
                         WritableMap obj = Arguments.createMap();
507
                         obj.putInt("uid", speakers[i].uid);
509
                         obj.putInt("uid", speakers[i].uid);
508
                         obj.putInt("volume", speakers[i].volume);
510
                         obj.putInt("volume", speakers[i].volume);
511
+                        obj.putInt("vad", speakers[i].vad);
509
                         arr.pushMap(obj);
512
                         arr.pushMap(obj);
510
                     }
513
                     }
511
 
514
 
1105
         }
1108
         }
1106
     };
1109
     };
1107
 
1110
 
1111
+    public void setAppType(RtcEngineEx engineEx) {
1112
+        engineEx.setAppType(8);
1113
+    }
1114
+
1108
     @ReactMethod
1115
     @ReactMethod
1109
     public void init(ReadableMap options) {
1116
     public void init(ReadableMap options) {
1110
         AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options);
1117
         AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options);
1111
         appId = options.getString("appid");
1118
         appId = options.getString("appid");
1112
         rtcEngine = AgoraManager.getInstance().mRtcEngine;
1119
         rtcEngine = AgoraManager.getInstance().mRtcEngine;
1120
+        setAppType((RtcEngineEx) rtcEngine);
1113
     }
1121
     }
1114
 
1122
 
1115
     @ReactMethod
1123
     @ReactMethod
1658
     }
1666
     }
1659
 
1667
 
1660
     @ReactMethod
1668
     @ReactMethod
1661
-    public void enableAudioVolumeIndication(int interval, int smooth, Promise promise) {
1662
-        Integer res = AgoraManager.getInstance().mRtcEngine.enableAudioVolumeIndication(interval, smooth);
1669
+    public void enableAudioVolumeIndication(int interval, int smooth, boolean vad, Promise promise) {
1670
+        Integer res = AgoraManager.getInstance().mRtcEngine.enableAudioVolumeIndication(interval, smooth, vad);
1663
         if (res == 0) {
1671
         if (res == 0) {
1664
             promise.resolve(null);
1672
             promise.resolve(null);
1665
         } else {
1673
         } else {
1888
         Integer res = AgoraManager.getInstance().mRtcEngine
1896
         Integer res = AgoraManager.getInstance().mRtcEngine
1889
                 .startAudioRecording(
1897
                 .startAudioRecording(
1890
                         options.getString("filepath"),
1898
                         options.getString("filepath"),
1899
+                        options.getInt("sampleRate"),
1891
                         options.getInt("quality")
1900
                         options.getInt("quality")
1892
                 );
1901
                 );
1893
         if (res == 0) {
1902
         if (res == 0) {
1999
 
2008
 
2000
     @ReactMethod
2009
     @ReactMethod
2001
     public void addVideoWatermark(ReadableMap options, Promise promise) {
2010
     public void addVideoWatermark(ReadableMap options, Promise promise) {
2011
+        String url = options.getString("url");
2012
+        ReadableMap watermarkOptions = options.getMap("options");
2013
+        ReadableMap positionLandscapeOptions = watermarkOptions.getMap("positionInPortraitMode");
2014
+        WatermarkOptions watermarkOpts = new WatermarkOptions();
2015
+        WatermarkOptions.Rectangle landscapePosition = new WatermarkOptions.Rectangle();
2016
+        landscapePosition.height = positionLandscapeOptions.getInt("height");
2017
+        landscapePosition.width = positionLandscapeOptions.getInt("width");
2018
+        landscapePosition.x = positionLandscapeOptions.getInt("x");
2019
+        landscapePosition.y = positionLandscapeOptions.getInt("y");
2020
+
2021
+        ReadableMap positionPortraitOptions = watermarkOptions.getMap("positionInPortraitMode");
2022
+        WatermarkOptions.Rectangle portraitPosition = new WatermarkOptions.Rectangle();
2023
+        portraitPosition.height = positionPortraitOptions.getInt("height");
2024
+        portraitPosition.width = positionPortraitOptions.getInt("width");
2025
+        portraitPosition.x = positionPortraitOptions.getInt("x");
2026
+        portraitPosition.y = positionPortraitOptions.getInt("y");
2027
+
2028
+        watermarkOpts.positionInLandscapeMode = landscapePosition;
2029
+        watermarkOpts.visibleInPreview = watermarkOptions.getBoolean("visibleInPreview");
2030
+        watermarkOpts.positionInPortraitMode = portraitPosition;
2002
         Integer res = AgoraManager.getInstance().mRtcEngine
2031
         Integer res = AgoraManager.getInstance().mRtcEngine
2003
-                .addVideoWatermark(createAgoraImage(options));
2032
+                .addVideoWatermark(url, watermarkOpts);
2004
         if (res == 0) {
2033
         if (res == 0) {
2005
             promise.resolve(null);
2034
             promise.resolve(null);
2006
         } else {
2035
         } else {
2642
                 break;
2671
                 break;
2643
             }
2672
             }
2644
         }
2673
         }
2645
-        CameraCapturerConfiguration config = new CameraCapturerConfiguration(preference);
2674
+        CameraCapturerConfiguration.CAMERA_DIRECTION cameraDirection = CameraCapturerConfiguration.CAMERA_DIRECTION.CAMERA_REAR;
2675
+        switch (options.getInt("cameraDirection")) {
2676
+            case 0: {
2677
+                cameraDirection = CameraCapturerConfiguration.CAMERA_DIRECTION.CAMERA_REAR;
2678
+                break;
2679
+            }
2680
+            case 1: {
2681
+                cameraDirection = CameraCapturerConfiguration.CAMERA_DIRECTION.CAMERA_FRONT;
2682
+                break;
2683
+            }
2684
+        }
2685
+        CameraCapturerConfiguration config = new CameraCapturerConfiguration(preference, cameraDirection);
2646
         Integer res = AgoraManager.getInstance().mRtcEngine.setCameraCapturerConfiguration(config);
2686
         Integer res = AgoraManager.getInstance().mRtcEngine.setCameraCapturerConfiguration(config);
2647
         if (res == 0) {
2687
         if (res == 0) {
2648
             promise.resolve(null);
2688
             promise.resolve(null);
2651
         }
2691
         }
2652
     }
2692
     }
2653
 
2693
 
2694
+    @ReactMethod
2695
+    public void setParameters(String paramStr, Promise promise) {
2696
+        Integer res = AgoraManager.getInstance().mRtcEngine.setParameters(paramStr);
2697
+        if (res == 0) {
2698
+            promise.resolve(null);
2699
+        } else {
2700
+            promise.reject("-1", res.toString());
2701
+        }
2702
+    }
2654
 
2703
 
2655
     @ReactMethod
2704
     @ReactMethod
2705
+    public void getParameter(String paramStr, String args, Promise promise) {
2706
+        String res = AgoraManager.getInstance().mRtcEngine.getParameter(paramStr, args);
2707
+        promise.resolve(res);
2708
+    }
2709
+
2710
+    @ReactMethod
2711
+    public void getParameters(String str, Promise promise) {
2712
+        String res = AgoraManager.getInstance().mRtcEngine.getParameters(str);
2713
+        promise.resolve(res);
2714
+    }
2656
 
2715
 
2657
     private void sendEvent(ReactContext reactContext,
2716
     private void sendEvent(ReactContext reactContext,
2658
                            String eventName,
2717
                            String eventName,

+ 101
- 0
ios/RCTAgora/AgoraConst.h View File

8
 
8
 
9
 #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
9
 #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
10
 
10
 
11
+typedef NS_ENUM(NSUInteger, AgoraRtcQualityReportFormat) {
12
+    AgoraRtc_QualityReportFormat_Json = 0,
13
+    AgoraRtc_QualityReportFormat_Html = 1,
14
+};
15
+
16
+typedef NS_ENUM(NSUInteger, AgoraRtcAppType) {
17
+    AgoraRtc_APP_TYPE_NATIVE = 0,
18
+    AgoraRtc_APP_TYPE_COCOS = 1,
19
+    AgoraRtc_APP_TYPE_UNITY = 2,
20
+    AgoraRtc_APP_TYPE_ELECTRON = 3,
21
+    AgoraRtc_APP_TYPE_FLUTTER = 4,
22
+    AgoraRtc_APP_TYPE_UNREAL = 5,
23
+    AgoraRtc_APP_TYPE_XAMARIN = 6,
24
+    AgoraRtc_APP_TYPE_APICLOUD = 7,
25
+    AgoraRtc_APP_TYPE_REACTNATIVE = 8
26
+};
27
+
28
+
29
+@protocol AgoraRtcEngineExtensionDelegate <AgoraRtcEngineDelegate>
30
+@optional
31
+- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine audioTransportQualityOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost;
32
+- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine videoTransportQualityOfUid:(NSUInteger)uid delay:(NSUInteger)delay lost:(NSUInteger)lost;
33
+@end
34
+
35
+
36
+@interface AgoraRtcEngineKit (AgoraExtension)
37
+
38
++ (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)appId
39
+                             extensionDelegate:(id<AgoraRtcEngineExtensionDelegate> _Nullable)delegate;
40
+
41
+/** Sets the profile to control the RTC engine.
42
+ *
43
+ *  @param profile SDK profile in JSON format.
44
+ *  @param merge Whether to merge the profile data with the original value.
45
+ */
46
+- (int)setProfile:(NSString * _Nonnull)profile
47
+            merge:(BOOL)merge;
48
+
49
+/** Set wrapper frame type by language wrapper.
50
+ *
51
+ *  @param appType wrapper frame type.
52
+ */
53
+- (int)setAppType:(AgoraRtcAppType)appType;
54
+
55
+/** END OF COMMON METHODS */
56
+
57
+/** BEGIN OF AUDIO METHODS */
58
+
59
+
60
+/**
61
+ *  Enable recap
62
+ *
63
+ *  @param interval &le; 0: Disabled, > 0: Interval in ms.
64
+ */
65
+- (int)enableRecap:(NSInteger)interval;
66
+
67
+/**
68
+ *  Start playing recap conversation
69
+ *
70
+ */
71
+- (int)playRecap;
72
+
73
+- (int)enableAudioQualityIndication:(BOOL)enabled;
74
+- (int)enableTransportQualityIndication:(BOOL)enabled;
75
+
76
+- (int)setVideoProfileEx:(NSInteger)width
77
+               andHeight:(NSInteger)height
78
+            andFrameRate:(NSInteger)frameRate
79
+              andBitrate:(NSInteger)andBitrate;
80
+
81
+- (int)sendReportData:(NSData * _Nonnull)data
82
+                 type:(NSInteger)type;
83
+/** END OF AUDIO METHODS */
84
+
85
+/** Queries internal states
86
+ * @param parameters
87
+ *     json string, array type
88
+ * @return a json string
89
+ */
90
+- (NSString * _Nullable)getParameters:(NSString * _Nonnull)parameters;
91
+
92
+/**
93
+ *  Generates a URL linking to the call quality reports. @param channel      The channel name specified in the joinChannel method.
94
+ *  @param listenerUid  The uid of the listener.
95
+ *  @param speakerUid   The uid of the speaker.
96
+ *  @param reportFormat The format of the report.
97
+                        AgoraRtc_QualityReportFormat_Json (0): JSON.: Returns the quality report data in Json.
98
+                        AgoraRtc_QualityReportFormat_Html (1): HTML.: Returns a report in HTML format, displayed on a web browser or WebVIEW components.
99
+ *
100
+ *  @return 0 when executed successfully. return minus value when failed. return AgoraRtc_Error_Invalid_Argument (-2):Invalid argument. return AgoraRtc_Error_Buffer_Too_Small (-6):The buffer length is too small.
101
+ */
102
+- (NSString * _Nullable)makeQualityReportUrl:(NSString * _Nonnull) channel
103
+                                 listenerUid:(NSUInteger)listenerUid
104
+                                 speakerrUid:(NSUInteger)speakerUid
105
+                                reportFormat:(AgoraRtcQualityReportFormat)reportFormat;
106
+
107
+/*********************************************************
108
+ * Large group conference call (experiment) - END
109
+ *********************************************************/
110
+@end
111
+
11
 static NSString *AG_PREFIX = @"ag_rtc";
112
 static NSString *AG_PREFIX = @"ag_rtc";
12
 
113
 
13
 static NSString *RCTAgoraErrorDomain = @"RCTAgoraErrorDomain";
114
 static NSString *RCTAgoraErrorDomain = @"RCTAgoraErrorDomain";

+ 50
- 10
ios/RCTAgora/RCTAgora.m View File

11
 #import <React/RCTBridge.h>
11
 #import <React/RCTBridge.h>
12
 #import <React/RCTUIManager.h>
12
 #import <React/RCTUIManager.h>
13
 #import <React/RCTView.h>
13
 #import <React/RCTView.h>
14
+#import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
14
 #import "AgoraConst.h"
15
 #import "AgoraConst.h"
15
 
16
 
16
 #define MAX_DATA_LENGTH 1024
17
 #define MAX_DATA_LENGTH 1024
181
   
182
   
182
   [AgoraConst share].rtcEngine = self.rtcEngine;
183
   [AgoraConst share].rtcEngine = self.rtcEngine;
183
   
184
   
185
+  [self.rtcEngine setAppType:AgoraRtc_APP_TYPE_REACTNATIVE];
184
   //channel mode
186
   //channel mode
185
   [self.rtcEngine setChannelProfile:[options[@"channelProfile"] integerValue]];
187
   [self.rtcEngine setChannelProfile:[options[@"channelProfile"] integerValue]];
186
   //enable dual stream
188
   //enable dual stream
770
 }
772
 }
771
 
773
 
772
 // enable audio volume indication
774
 // enable audio volume indication
773
-RCT_EXPORT_METHOD(enableAudioVolumeIndication: (NSInteger) interval smooth:(NSInteger)smooth
775
+RCT_EXPORT_METHOD(enableAudioVolumeIndication: (NSInteger) interval smooth:(NSInteger)smooth 
776
+                  report_vad:(BOOL)report_vad
774
                   resolve:(RCTPromiseResolveBlock)resolve
777
                   resolve:(RCTPromiseResolveBlock)resolve
775
                   reject:(RCTPromiseRejectBlock)reject) {
778
                   reject:(RCTPromiseRejectBlock)reject) {
776
-  NSInteger res = [self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth];
779
+  NSInteger res = [self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth report_vad:report_vad];
777
   if (res == 0) {
780
   if (res == 0) {
778
     resolve(nil);
781
     resolve(nil);
779
   } else {
782
   } else {
1269
 RCT_EXPORT_METHOD(addVideoWatermark:(NSDictionary *)options
1272
 RCT_EXPORT_METHOD(addVideoWatermark:(NSDictionary *)options
1270
                   resolve:(RCTPromiseResolveBlock)resolve
1273
                   resolve:(RCTPromiseResolveBlock)resolve
1271
                   reject:(RCTPromiseRejectBlock)reject) {
1274
                   reject:(RCTPromiseRejectBlock)reject) {
1272
-  NSInteger res = [self.rtcEngine addVideoWatermark:[self makeAgoraImage:@{
1273
-                                                                           @"url": options[@"url"],
1274
-                                                                           @"x": options[@"x"],
1275
-                                                                           @"y": options[@"y"],
1276
-                                                                           @"width": options[@"width"],
1277
-                                                                           @"height": options[@"height"]
1278
-                                                                           }]];
1275
+    NSString *urlStr = options[@"url"];
1276
+    NSDictionary *watermarkOptions = options[@"options"];
1277
+    WatermarkOptions *watermarkOpts = [WatermarkOptions new];
1278
+    watermarkOpts.visibleInPreview = [watermarkOptions[@"visibleInPreview"] boolValue];
1279
+    NSDictionary *optionPortrait = watermarkOptions[@"positionInPortraitMode"];
1280
+    watermarkOpts.positionInPortraitMode = CGRectMake((CGFloat)[optionPortrait[@"x"] floatValue],
1281
+                               (CGFloat)[optionPortrait[@"y"] floatValue],
1282
+                               (CGFloat)[optionPortrait[@"width"] floatValue],
1283
+                               (CGFloat)[optionPortrait[@"height"] floatValue]);
1284
+    NSDictionary *optionLandscape = watermarkOptions[@"positionInLandscapeMode"];
1285
+    watermarkOpts.positionInLandscapeMode = CGRectMake((CGFloat)[optionLandscape[@"x"] floatValue],
1286
+                               (CGFloat)[optionLandscape[@"y"] floatValue],
1287
+                               (CGFloat)[optionLandscape[@"width"] floatValue],
1288
+                               (CGFloat)[optionLandscape[@"height"] floatValue]);
1289
+    NSURL *url = [NSURL URLWithString:urlStr];
1290
+    NSInteger res = [self.rtcEngine addVideoWatermark:url options:watermarkOpts];
1279
   if (res == 0) {
1291
   if (res == 0) {
1280
     resolve(nil);
1292
     resolve(nil);
1281
   } else {
1293
   } else {
1755
   
1767
   
1756
   AgoraCameraCapturerConfiguration* configuration = [[AgoraCameraCapturerConfiguration alloc] init];
1768
   AgoraCameraCapturerConfiguration* configuration = [[AgoraCameraCapturerConfiguration alloc] init];
1757
   configuration.preference = [config[@"preference"] integerValue];
1769
   configuration.preference = [config[@"preference"] integerValue];
1770
+  configuration.cameraDirection = [config[@"cameraDirection"] integerValue];
1758
   
1771
   
1759
   NSInteger res = [self.rtcEngine setCameraCapturerConfiguration:configuration];
1772
   NSInteger res = [self.rtcEngine setCameraCapturerConfiguration:configuration];
1760
   if (res == 0) {
1773
   if (res == 0) {
1788
   }
1801
   }
1789
 }
1802
 }
1790
 
1803
 
1804
+RCT_EXPORT_METHOD(setParameters:(NSString *)paramStr
1805
+                  resolve:(RCTPromiseResolveBlock)resolve
1806
+                  reject:(RCTPromiseRejectBlock)reject) {
1807
+  NSInteger res = [self.rtcEngine setParameters:paramStr];
1808
+  if (res == 0) {
1809
+    resolve(nil);
1810
+  } else {
1811
+    reject(@(-1).stringValue, @(-1).stringValue, nil);
1812
+  }
1813
+}
1814
+
1815
+RCT_EXPORT_METHOD(getParameter:(NSString *)paramStr
1816
+                  args:(NSString *)args
1817
+                  resolve:(RCTPromiseResolveBlock)resolve
1818
+                  reject:(RCTPromiseRejectBlock)reject) {
1819
+  NSString *res = [self.rtcEngine getParameter:paramStr args:args];
1820
+  resolve(res);
1821
+}
1822
+
1823
+RCT_EXPORT_METHOD(getParameters:(NSString *)paramStr
1824
+                  resolve:(RCTPromiseResolveBlock)resolve
1825
+                  reject:(RCTPromiseRejectBlock)reject) {
1826
+  NSString *res = [self.rtcEngine getParameters:paramStr];
1827
+  resolve(res);
1828
+}
1829
+
1791
 - (NSArray<NSString *> *)supportedEvents {
1830
 - (NSArray<NSString *> *)supportedEvents {
1792
   return [AgoraConst supportEvents];
1831
   return [AgoraConst supportEvents];
1793
 }
1832
 }
1971
   for (AgoraRtcAudioVolumeInfo *speaker in speakers) {
2010
   for (AgoraRtcAudioVolumeInfo *speaker in speakers) {
1972
     [result addObject:@{
2011
     [result addObject:@{
1973
                         @"uid": @(speaker.uid),
2012
                         @"uid": @(speaker.uid),
1974
-                        @"volume": @(speaker.volume)
2013
+                        @"volume": @(speaker.volume),
2014
+                        @"vad": @(speaker.vad),
1975
                         }];
2015
                         }];
1976
   }
2016
   }
1977
   [self sendEvent:AGAudioVolumeIndication params:@{
2017
   [self sendEvent:AGAudioVolumeIndication params:@{

BIN
ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework/AgoraRtcCryptoLoader View File


+ 0
- 12
ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework/Headers/AgoraRtcCryptoLoader.h View File

1
-//
2
-//  AgoraRtcCryptoLoader.h
3
-//  AgoraRtcCryptoLoader
4
-//
5
-//  Copyright © 2018 Agora. All rights reserved.
6
-//
7
-
8
-#import <Foundation/Foundation.h>
9
-
10
-@interface AgoraRtcCryptoLoader : NSObject
11
-
12
-@end

BIN
ios/RCTAgora/libs/libcrypto.a View File


+ 30
- 3
lib/RtcEngine.native.d.ts View File

21
      * This method creates and start event observer. You should call this method once.
21
      * This method creates and start event observer. You should call this method once.
22
      * @example `RtcEngine.init(option)`
22
      * @example `RtcEngine.init(option)`
23
      * @param options Defines the property of the client, see {@link Option} for details.
23
      * @param options Defines the property of the client, see {@link Option} for details.
24
+     * @returns any
24
      */
25
      */
25
     static init(options: Option): void;
26
     static init(options: Option): void;
26
     /**
27
     /**
32
      * @param uid
33
      * @param uid
33
      * @param token
34
      * @param token
34
      * @param info
35
      * @param info
36
+     * @returns Promise<any>
35
      */
37
      */
36
     static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): Promise<any>;
38
     static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): Promise<any>;
37
     /**
39
     /**
44
      * Occurs joinChannelSuccess when achieve joining stage
46
      * Occurs joinChannelSuccess when achieve joining stage
45
      * @param channelName {@link string}
47
      * @param channelName {@link string}
46
      * @param token {@link string}
48
      * @param token {@link string}
49
+     * @returns Promise<any>
47
      */
50
      */
48
     static switchChannel(channelName: string, token?: string): Promise<any>;
51
     static switchChannel(channelName: string, token?: string): Promise<any>;
49
     /**
52
     /**
54
      *  Occurs mediaRelayStateChanged
57
      *  Occurs mediaRelayStateChanged
55
      *  Occurs receivedChannelMediaRelay when peer channel received this message
58
      *  Occurs receivedChannelMediaRelay when peer channel received this message
56
      * @param config {@link ChannelMediaConfiguration}
59
      * @param config {@link ChannelMediaConfiguration}
60
+     * @returns Promise<any>
57
      */
61
      */
58
     static startChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
62
     static startChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
59
     /**
63
     /**
63
      * It will occurs event:
67
      * It will occurs event:
64
      *  Occurs mediaRelayStateChanged
68
      *  Occurs mediaRelayStateChanged
65
      * @param config {@link ChannelMediaConfiguration}
69
      * @param config {@link ChannelMediaConfiguration}
70
+     * @returns Promise<any>
66
      */
71
      */
67
     static removeChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
72
     static removeChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
68
     /**
73
     /**
72
      * It will occurs event:
77
      * It will occurs event:
73
      *  Occurs mediaRelayStateChanged
78
      *  Occurs mediaRelayStateChanged
74
      * @param config {@link ChannelMediaConfiguration}
79
      * @param config {@link ChannelMediaConfiguration}
80
+     * @returns Promise<any>
75
      */
81
      */
76
     static updateChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
82
     static updateChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
77
     /**
83
     /**
81
      * It will occurs event:
87
      * It will occurs event:
82
      *  Occurs mediaRelayStateChanged
88
      *  Occurs mediaRelayStateChanged
83
      * @param config {@link ChannelMediaConfiguration}
89
      * @param config {@link ChannelMediaConfiguration}
90
+     * @returns Promise<any>
84
      */
91
      */
85
     static stopChannelMediaRelay(): Promise<any>;
92
     static stopChannelMediaRelay(): Promise<any>;
86
     /**
93
     /**
462
      * @param smooth
469
      * @param smooth
463
      * @return Promise<any>
470
      * @return Promise<any>
464
      */
471
      */
465
-    static enableAudioVolumeIndication(interval: number, smooth: number): Promise<any>;
472
+    static enableAudioVolumeIndication(interval: number, smooth: number, vad: boolean): Promise<any>;
466
     /**
473
     /**
467
      * check for mobile phone speaker enabled
474
      * check for mobile phone speaker enabled
468
      *
475
      *
771
      * @param options {@link ImageOption}
778
      * @param options {@link ImageOption}
772
      * @return Promise<{success, value}>
779
      * @return Promise<{success, value}>
773
      */
780
      */
774
-    static addVideoWatermark(options: ImageOption): Promise<any>;
781
+    static addVideoWatermark(url: string, options: ImageOption): Promise<any>;
775
     /**
782
     /**
776
      * clear video watermarks
783
      * clear video watermarks
777
      *
784
      *
1177
      *         console.log("your currrent camera", info);
1184
      *         console.log("your currrent camera", info);
1178
      *      })
1185
      *      })
1179
      * ```
1186
      * ```
1180
-     * @return Promise{cameraSupportInfo}>
1187
+     * @return Promise<{cameraSupportInfo}>
1181
      */
1188
      */
1182
     static getCameraInfo(): Promise<any>;
1189
     static getCameraInfo(): Promise<any>;
1190
+    /**
1191
+     * Set Private Parameters
1192
+     * @param paramsStr
1193
+     * @return Promise<bool>
1194
+     */
1195
+    static setParameters(paramsStr: string): Promise<any>;
1196
+    /**
1197
+     * Get Private Parameter
1198
+     * @param paramsStr
1199
+     * @param args
1200
+     * @return Promise<string>
1201
+     */
1202
+    static getParameter(paramsStr: string, args: string): Promise<string>;
1203
+    /**
1204
+     * Get Private Parameters
1205
+     * @param paramsStr
1206
+     * @param args
1207
+     * @return Promise<string>
1208
+     */
1209
+    static getParameters(paramsStr: string): Promise<string>;
1183
 }
1210
 }
1184
 export default RtcEngine;
1211
 export default RtcEngine;

+ 44
- 5
lib/RtcEngine.native.js View File

18
      * This method creates and start event observer. You should call this method once.
18
      * This method creates and start event observer. You should call this method once.
19
      * @example `RtcEngine.init(option)`
19
      * @example `RtcEngine.init(option)`
20
      * @param options Defines the property of the client, see {@link Option} for details.
20
      * @param options Defines the property of the client, see {@link Option} for details.
21
+     * @returns any
21
      */
22
      */
22
     static init(options) {
23
     static init(options) {
23
         Agora.init(options);
24
         Agora.init(options);
31
      * @param uid
32
      * @param uid
32
      * @param token
33
      * @param token
33
      * @param info
34
      * @param info
35
+     * @returns Promise<any>
34
      */
36
      */
35
     static joinChannel(channelName, uid, token, info) {
37
     static joinChannel(channelName, uid, token, info) {
36
         return Agora.joinChannel({ channelName, uid, token, info });
38
         return Agora.joinChannel({ channelName, uid, token, info });
45
      * Occurs joinChannelSuccess when achieve joining stage
47
      * Occurs joinChannelSuccess when achieve joining stage
46
      * @param channelName {@link string}
48
      * @param channelName {@link string}
47
      * @param token {@link string}
49
      * @param token {@link string}
50
+     * @returns Promise<any>
48
      */
51
      */
49
     static switchChannel(channelName, token) {
52
     static switchChannel(channelName, token) {
50
         return Agora.switchChannel({ channelName, token });
53
         return Agora.switchChannel({ channelName, token });
57
      *  Occurs mediaRelayStateChanged
60
      *  Occurs mediaRelayStateChanged
58
      *  Occurs receivedChannelMediaRelay when peer channel received this message
61
      *  Occurs receivedChannelMediaRelay when peer channel received this message
59
      * @param config {@link ChannelMediaConfiguration}
62
      * @param config {@link ChannelMediaConfiguration}
63
+     * @returns Promise<any>
60
      */
64
      */
61
     static startChannelMediaRelay(config) {
65
     static startChannelMediaRelay(config) {
62
         return Agora.startChannelMediaRelay(config);
66
         return Agora.startChannelMediaRelay(config);
68
      * It will occurs event:
72
      * It will occurs event:
69
      *  Occurs mediaRelayStateChanged
73
      *  Occurs mediaRelayStateChanged
70
      * @param config {@link ChannelMediaConfiguration}
74
      * @param config {@link ChannelMediaConfiguration}
75
+     * @returns Promise<any>
71
      */
76
      */
72
     static removeChannelMediaRelay(config) {
77
     static removeChannelMediaRelay(config) {
73
         return Agora.removeChannelMediaRelay(config);
78
         return Agora.removeChannelMediaRelay(config);
79
      * It will occurs event:
84
      * It will occurs event:
80
      *  Occurs mediaRelayStateChanged
85
      *  Occurs mediaRelayStateChanged
81
      * @param config {@link ChannelMediaConfiguration}
86
      * @param config {@link ChannelMediaConfiguration}
87
+     * @returns Promise<any>
82
      */
88
      */
83
     static updateChannelMediaRelay(config) {
89
     static updateChannelMediaRelay(config) {
84
         return Agora.updateChannelMediaRelay(config);
90
         return Agora.updateChannelMediaRelay(config);
90
      * It will occurs event:
96
      * It will occurs event:
91
      *  Occurs mediaRelayStateChanged
97
      *  Occurs mediaRelayStateChanged
92
      * @param config {@link ChannelMediaConfiguration}
98
      * @param config {@link ChannelMediaConfiguration}
99
+     * @returns Promise<any>
93
      */
100
      */
94
     static stopChannelMediaRelay() {
101
     static stopChannelMediaRelay() {
95
         return Agora.stopChannelMediaRelay();
102
         return Agora.stopChannelMediaRelay();
634
      * @param smooth
641
      * @param smooth
635
      * @return Promise<any>
642
      * @return Promise<any>
636
      */
643
      */
637
-    static enableAudioVolumeIndication(interval, smooth) {
638
-        return Agora.enableAudioVolumeIndication(interval, smooth);
644
+    static enableAudioVolumeIndication(interval, smooth, vad) {
645
+        return Agora.enableAudioVolumeIndication(interval, smooth, vad);
639
     }
646
     }
640
     /**
647
     /**
641
      * check for mobile phone speaker enabled
648
      * check for mobile phone speaker enabled
1021
      * @param options {@link ImageOption}
1028
      * @param options {@link ImageOption}
1022
      * @return Promise<{success, value}>
1029
      * @return Promise<{success, value}>
1023
      */
1030
      */
1024
-    static addVideoWatermark(options) {
1025
-        return Agora.addVideoWatermark(options);
1031
+    static addVideoWatermark(url, options) {
1032
+        return Agora.addVideoWatermark({ url, options });
1026
     }
1033
     }
1027
     /**
1034
     /**
1028
      * clear video watermarks
1035
      * clear video watermarks
1509
      *         console.log("your currrent camera", info);
1516
      *         console.log("your currrent camera", info);
1510
      *      })
1517
      *      })
1511
      * ```
1518
      * ```
1512
-     * @return Promise{cameraSupportInfo}>
1519
+     * @return Promise<{cameraSupportInfo}>
1513
      */
1520
      */
1514
     static getCameraInfo() {
1521
     static getCameraInfo() {
1515
         return tslib_1.__awaiter(this, void 0, void 0, function* () {
1522
         return tslib_1.__awaiter(this, void 0, void 0, function* () {
1516
             return Agora.getCameraInfo();
1523
             return Agora.getCameraInfo();
1517
         });
1524
         });
1518
     }
1525
     }
1526
+    /**
1527
+     * Set Private Parameters
1528
+     * @param paramsStr
1529
+     * @return Promise<bool>
1530
+     */
1531
+    static setParameters(paramsStr) {
1532
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
1533
+            return Agora.setParameters(paramsStr);
1534
+        });
1535
+    }
1536
+    /**
1537
+     * Get Private Parameter
1538
+     * @param paramsStr
1539
+     * @param args
1540
+     * @return Promise<string>
1541
+     */
1542
+    static getParameter(paramsStr, args) {
1543
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
1544
+            return Agora.getParameter(paramsStr, args);
1545
+        });
1546
+    }
1547
+    /**
1548
+     * Get Private Parameters
1549
+     * @param paramsStr
1550
+     * @param args
1551
+     * @return Promise<string>
1552
+     */
1553
+    static getParameters(paramsStr) {
1554
+        return tslib_1.__awaiter(this, void 0, void 0, function* () {
1555
+            return Agora.getParameters(paramsStr);
1556
+        });
1557
+    }
1519
 }
1558
 }
1520
 /**
1559
 /**
1521
  * @ignore eventTypes
1560
  * @ignore eventTypes

+ 1
- 1
lib/RtcEngine.native.js.map
File diff suppressed because it is too large
View File


+ 15
- 5
lib/types.d.ts View File

204
 }
204
 }
205
 export interface AudioRecordingOption {
205
 export interface AudioRecordingOption {
206
     filepath: String;
206
     filepath: String;
207
+    sampleRate: number;
207
     quality: number;
208
     quality: number;
208
 }
209
 }
209
 export declare type Callback<T> = (err: any, data: any) => T;
210
 export declare type Callback<T> = (err: any, data: any) => T;
248
     samplesPerCall: number;
249
     samplesPerCall: number;
249
 }
250
 }
250
 export interface ImageOption {
251
 export interface ImageOption {
251
-    url: String;
252
-    height: number;
253
-    width: number;
254
-    x: number;
255
-    y: number;
252
+    visibleInPreview: boolean;
253
+    positionInPortraitMode: {
254
+        x: number;
255
+        y: number;
256
+        width: number;
257
+        height: number;
258
+    };
259
+    positionInLandscapeMode: {
260
+        x: number;
261
+        y: number;
262
+        width: number;
263
+        height: number;
264
+    };
256
 }
265
 }
257
 export interface VideoStreamOption {
266
 export interface VideoStreamOption {
258
     uid: number;
267
     uid: number;
322
  */
331
  */
323
 export interface CameraCapturerConfiguration {
332
 export interface CameraCapturerConfiguration {
324
     preference: number;
333
     preference: number;
334
+    cameraDirection: number;
325
 }
335
 }

+ 1
- 1
package.json View File

1
 {
1
 {
2
   "name": "react-native-agora",
2
   "name": "react-native-agora",
3
-  "version": "2.9.0-alpha.3",
3
+  "version": "2.9.1-alpha.1",
4
   "description": "React Native around the Agora RTC SDKs for Android and iOS agora",
4
   "description": "React Native around the Agora RTC SDKs for Android and iOS agora",
5
   "summary": "agora native sdk for react-native",
5
   "summary": "agora native sdk for react-native",
6
   "main": "lib/index.js",
6
   "main": "lib/index.js",

+ 2
- 7
react-native-agora.podspec View File

9
     s.homepage       = package['homepage']
9
     s.homepage       = package['homepage']
10
     s.license        = package['license']
10
     s.license        = package['license']
11
     s.authors        = package["authors"]
11
     s.authors        = package["authors"]
12
-    s.platform       = :ios, "7.0"
12
+    s.platform       = :ios, "8.0"
13
 
13
 
14
     s.source         = { :git => package["repository"]["url"] }
14
     s.source         = { :git => package["repository"]["url"] }
15
     s.source_files   = 'ios/RCTAgora/*.{h,m}'
15
     s.source_files   = 'ios/RCTAgora/*.{h,m}'
16
 
16
 
17
-    s.subspec 'AgoraRtcCryptoLoader' do |sp|
18
-        sp.source_files = './ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework/**/*.{c,h,m,mm,S,cpp}'
19
-        sp.vendored_libraries = 'libcrypto.a'
20
-    end
21
-
22
     s.dependency 'React'
17
     s.dependency 'React'
23
-    s.dependency "AgoraRtcEngine_iOS", "2.9"
18
+    s.dependency "AgoraRtcEngine_iOS", "2.9.1"
24
 end
19
 end

+ 34
- 5
src/RtcEngine.native.ts View File

728
      * @param smooth
728
      * @param smooth
729
      * @return Promise<any>
729
      * @return Promise<any>
730
      */
730
      */
731
-    public static enableAudioVolumeIndication(interval: number, smooth: number): Promise<any> {
732
-        return Agora.enableAudioVolumeIndication(interval, smooth);
731
+    public static enableAudioVolumeIndication(interval: number, smooth: number, vad: boolean): Promise<any> {
732
+        return Agora.enableAudioVolumeIndication(interval, smooth, vad);
733
     }
733
     }
734
 
734
 
735
     /**
735
     /**
1154
      * @param options {@link ImageOption}
1154
      * @param options {@link ImageOption}
1155
      * @return Promise<{success, value}>
1155
      * @return Promise<{success, value}>
1156
      */
1156
      */
1157
-    public static addVideoWatermark(options: ImageOption): Promise<any> {
1158
-        return Agora.addVideoWatermark(options);
1157
+    public static addVideoWatermark(url: string, options: ImageOption): Promise<any> {
1158
+        return Agora.addVideoWatermark({url, options});
1159
     }
1159
     }
1160
 
1160
 
1161
     /**
1161
     /**
1685
      *         console.log("your currrent camera", info);
1685
      *         console.log("your currrent camera", info);
1686
      *      })
1686
      *      })
1687
      * ```
1687
      * ```
1688
-     * @return Promise{cameraSupportInfo}>
1688
+     * @return Promise<{cameraSupportInfo}>
1689
      */
1689
      */
1690
     static async getCameraInfo(): Promise<any> {
1690
     static async getCameraInfo(): Promise<any> {
1691
         return Agora.getCameraInfo();
1691
         return Agora.getCameraInfo();
1692
     }
1692
     }
1693
+
1694
+    /**
1695
+     * Set Private Parameters
1696
+     * @param paramsStr 
1697
+     * @return Promise<bool>
1698
+     */
1699
+    static async setParameters(paramsStr: string): Promise<any> {
1700
+        return Agora.setParameters(paramsStr);
1701
+    }
1702
+
1703
+    /**
1704
+     * Get Private Parameter
1705
+     * @param paramsStr 
1706
+     * @param args 
1707
+     * @return Promise<string>
1708
+     */
1709
+    static async getParameter(paramsStr: string, args: string): Promise<string> {
1710
+        return Agora.getParameter(paramsStr, args);
1711
+    }
1712
+
1713
+    /**
1714
+     * Get Private Parameters
1715
+     * @param paramsStr 
1716
+     * @param args 
1717
+     * @return Promise<string>
1718
+     */
1719
+    static async getParameters(paramsStr: string): Promise<string> {
1720
+        return Agora.getParameters(paramsStr);
1721
+    }
1693
 }
1722
 }
1694
 
1723
 
1695
 export default RtcEngine;
1724
 export default RtcEngine;

+ 15
- 5
src/types.ts View File

222
 
222
 
223
 export interface AudioRecordingOption {
223
 export interface AudioRecordingOption {
224
   filepath: String,
224
   filepath: String,
225
+  sampleRate: number,
225
   quality: number
226
   quality: number
226
 }
227
 }
227
 
228
 
276
 }
277
 }
277
 
278
 
278
 export interface ImageOption {
279
 export interface ImageOption {
279
-  url: String,
280
-  height: number,
281
-  width: number,
282
-  x: number,
283
-  y: number
280
+  visibleInPreview: boolean
281
+  positionInPortraitMode: {
282
+    x: number,
283
+    y: number,
284
+    width: number,
285
+    height: number,
286
+  }
287
+  positionInLandscapeMode: {
288
+    x: number,
289
+    y: number,
290
+    width: number,
291
+    height: number,
292
+  }
284
 }
293
 }
285
 
294
 
286
 export interface VideoStreamOption {
295
 export interface VideoStreamOption {
361
  */
370
  */
362
 export interface CameraCapturerConfiguration {
371
 export interface CameraCapturerConfiguration {
363
   preference: number
372
   preference: number
373
+  cameraDirection: number
364
 }
374
 }