Kaynağa Gözat

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

feat. support ios & android 2.9.1
matrixbirds 5 yıl önce
ebeveyn
işleme
dbacf962d4
No account linked to committer's email address

+ 3
- 0
CHANGELOG Dosyayı Görüntüle

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

+ 1
- 1
android/build.gradle Dosyayı Görüntüle

@@ -61,7 +61,7 @@ dependencies {
61 61
     def androidSupportVersion = rootProject.hasProperty("androidSupportVersion")  ? rootProject.androidSupportVersion : DEFAULT_ANDROID_SUPPORT_VERSION
62 62
     // from internet
63 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 65
     // from node_modules
66 66
     implementation "com.facebook.react:react-native:+"
67 67
 }

+ 4
- 2
android/src/main/java/com/syan/agora/AgoraManager.java Dosyayı Görüntüle

@@ -16,6 +16,7 @@ import java.util.Map;
16 16
 import io.agora.rtc.IMetadataObserver;
17 17
 import io.agora.rtc.IRtcEngineEventHandler;
18 18
 import io.agora.rtc.RtcEngine;
19
+import io.agora.rtc.RtcEngineEx;
19 20
 import io.agora.rtc.video.BeautyOptions;
20 21
 import io.agora.rtc.video.VideoCanvas;
21 22
 import io.agora.rtc.video.VideoEncoderConfiguration;
@@ -31,7 +32,7 @@ public class AgoraManager {
31 32
 
32 33
     public static AgoraManager sAgoraManager;
33 34
 
34
-    public RtcEngine mRtcEngine;
35
+    public RtcEngineEx mRtcEngine;
35 36
 
36 37
     private Context context;
37 38
 
@@ -102,7 +103,8 @@ public class AgoraManager {
102 103
         //create rtcEngine instance and setup rtcEngine eventHandler
103 104
         try {
104 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 108
             if (options.hasKey("secret") && null != options.getString("secret")) {
107 109
                 mRtcEngine.setEncryptionSecret(options.getString("secret"));
108 110
                 if (options.hasKey("secretMode") && null != options.getString("secretMode")) {

+ 63
- 4
android/src/main/java/com/syan/agora/AgoraModule.java Dosyayı Görüntüle

@@ -28,6 +28,7 @@ import io.agora.rtc.IAudioEffectManager;
28 28
 import io.agora.rtc.IMetadataObserver;
29 29
 import io.agora.rtc.IRtcEngineEventHandler;
30 30
 import io.agora.rtc.RtcEngine;
31
+import io.agora.rtc.RtcEngineEx;
31 32
 import io.agora.rtc.internal.LastmileProbeConfig;
32 33
 import io.agora.rtc.live.LiveInjectStreamConfig;
33 34
 import io.agora.rtc.live.LiveTranscoding;
@@ -38,6 +39,7 @@ import io.agora.rtc.video.CameraCapturerConfiguration;
38 39
 import io.agora.rtc.video.ChannelMediaInfo;
39 40
 import io.agora.rtc.video.ChannelMediaRelayConfiguration;
40 41
 import io.agora.rtc.video.VideoEncoderConfiguration;
42
+import io.agora.rtc.video.WatermarkOptions;
41 43
 
42 44
 import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;
43 45
 import static com.syan.agora.AgoraConst.*;
@@ -506,6 +508,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
506 508
                         WritableMap obj = Arguments.createMap();
507 509
                         obj.putInt("uid", speakers[i].uid);
508 510
                         obj.putInt("volume", speakers[i].volume);
511
+                        obj.putInt("vad", speakers[i].vad);
509 512
                         arr.pushMap(obj);
510 513
                     }
511 514
 
@@ -1105,11 +1108,16 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1105 1108
         }
1106 1109
     };
1107 1110
 
1111
+    public void setAppType(RtcEngineEx engineEx) {
1112
+        engineEx.setAppType(8);
1113
+    }
1114
+
1108 1115
     @ReactMethod
1109 1116
     public void init(ReadableMap options) {
1110 1117
         AgoraManager.getInstance().init(getReactApplicationContext(), mRtcEventHandler, options);
1111 1118
         appId = options.getString("appid");
1112 1119
         rtcEngine = AgoraManager.getInstance().mRtcEngine;
1120
+        setAppType((RtcEngineEx) rtcEngine);
1113 1121
     }
1114 1122
 
1115 1123
     @ReactMethod
@@ -1658,8 +1666,8 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1658 1666
     }
1659 1667
 
1660 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 1671
         if (res == 0) {
1664 1672
             promise.resolve(null);
1665 1673
         } else {
@@ -1888,6 +1896,7 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1888 1896
         Integer res = AgoraManager.getInstance().mRtcEngine
1889 1897
                 .startAudioRecording(
1890 1898
                         options.getString("filepath"),
1899
+                        options.getInt("sampleRate"),
1891 1900
                         options.getInt("quality")
1892 1901
                 );
1893 1902
         if (res == 0) {
@@ -1999,8 +2008,28 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1999 2008
 
2000 2009
     @ReactMethod
2001 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 2031
         Integer res = AgoraManager.getInstance().mRtcEngine
2003
-                .addVideoWatermark(createAgoraImage(options));
2032
+                .addVideoWatermark(url, watermarkOpts);
2004 2033
         if (res == 0) {
2005 2034
             promise.resolve(null);
2006 2035
         } else {
@@ -2642,7 +2671,18 @@ public class AgoraModule extends ReactContextBaseJavaModule {
2642 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 2686
         Integer res = AgoraManager.getInstance().mRtcEngine.setCameraCapturerConfiguration(config);
2647 2687
         if (res == 0) {
2648 2688
             promise.resolve(null);
@@ -2651,8 +2691,27 @@ public class AgoraModule extends ReactContextBaseJavaModule {
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 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 2716
     private void sendEvent(ReactContext reactContext,
2658 2717
                            String eventName,

+ 101
- 0
ios/RCTAgora/AgoraConst.h Dosyayı Görüntüle

@@ -8,6 +8,107 @@
8 8
 
9 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 112
 static NSString *AG_PREFIX = @"ag_rtc";
12 113
 
13 114
 static NSString *RCTAgoraErrorDomain = @"RCTAgoraErrorDomain";

+ 50
- 10
ios/RCTAgora/RCTAgora.m Dosyayı Görüntüle

@@ -11,6 +11,7 @@
11 11
 #import <React/RCTBridge.h>
12 12
 #import <React/RCTUIManager.h>
13 13
 #import <React/RCTView.h>
14
+#import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
14 15
 #import "AgoraConst.h"
15 16
 
16 17
 #define MAX_DATA_LENGTH 1024
@@ -181,6 +182,7 @@ RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
181 182
   
182 183
   [AgoraConst share].rtcEngine = self.rtcEngine;
183 184
   
185
+  [self.rtcEngine setAppType:AgoraRtc_APP_TYPE_REACTNATIVE];
184 186
   //channel mode
185 187
   [self.rtcEngine setChannelProfile:[options[@"channelProfile"] integerValue]];
186 188
   //enable dual stream
@@ -770,10 +772,11 @@ RCT_EXPORT_METHOD(adjustPlaybackSignalVolume: (NSInteger) volume
770 772
 }
771 773
 
772 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 777
                   resolve:(RCTPromiseResolveBlock)resolve
775 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 780
   if (res == 0) {
778 781
     resolve(nil);
779 782
   } else {
@@ -1269,13 +1272,22 @@ RCT_EXPORT_METHOD(setMixedAudioFrameParametersWithSampleRate
1269 1272
 RCT_EXPORT_METHOD(addVideoWatermark:(NSDictionary *)options
1270 1273
                   resolve:(RCTPromiseResolveBlock)resolve
1271 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 1291
   if (res == 0) {
1280 1292
     resolve(nil);
1281 1293
   } else {
@@ -1755,6 +1767,7 @@ RCT_EXPORT_METHOD(setCameraCapturerConfiguration:(NSDictionary *)config
1755 1767
   
1756 1768
   AgoraCameraCapturerConfiguration* configuration = [[AgoraCameraCapturerConfiguration alloc] init];
1757 1769
   configuration.preference = [config[@"preference"] integerValue];
1770
+  configuration.cameraDirection = [config[@"cameraDirection"] integerValue];
1758 1771
   
1759 1772
   NSInteger res = [self.rtcEngine setCameraCapturerConfiguration:configuration];
1760 1773
   if (res == 0) {
@@ -1788,6 +1801,32 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
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 1830
 - (NSArray<NSString *> *)supportedEvents {
1792 1831
   return [AgoraConst supportEvents];
1793 1832
 }
@@ -1971,7 +2010,8 @@ RCT_EXPORT_METHOD(registerMediaMetadataObserver
1971 2010
   for (AgoraRtcAudioVolumeInfo *speaker in speakers) {
1972 2011
     [result addObject:@{
1973 2012
                         @"uid": @(speaker.uid),
1974
-                        @"volume": @(speaker.volume)
2013
+                        @"volume": @(speaker.volume),
2014
+                        @"vad": @(speaker.vad),
1975 2015
                         }];
1976 2016
   }
1977 2017
   [self sendEvent:AGAudioVolumeIndication params:@{

BIN
ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework/AgoraRtcCryptoLoader Dosyayı Görüntüle


+ 0
- 12
ios/RCTAgora/libs/AgoraRtcCryptoLoader.framework/Headers/AgoraRtcCryptoLoader.h Dosyayı Görüntüle

@@ -1,12 +0,0 @@
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 Dosyayı Görüntüle


+ 30
- 3
lib/RtcEngine.native.d.ts Dosyayı Görüntüle

@@ -21,6 +21,7 @@ declare class RtcEngine {
21 21
      * This method creates and start event observer. You should call this method once.
22 22
      * @example `RtcEngine.init(option)`
23 23
      * @param options Defines the property of the client, see {@link Option} for details.
24
+     * @returns any
24 25
      */
25 26
     static init(options: Option): void;
26 27
     /**
@@ -32,6 +33,7 @@ declare class RtcEngine {
32 33
      * @param uid
33 34
      * @param token
34 35
      * @param info
36
+     * @returns Promise<any>
35 37
      */
36 38
     static joinChannel(channelName: string, uid?: number, token?: string, info?: Object): Promise<any>;
37 39
     /**
@@ -44,6 +46,7 @@ declare class RtcEngine {
44 46
      * Occurs joinChannelSuccess when achieve joining stage
45 47
      * @param channelName {@link string}
46 48
      * @param token {@link string}
49
+     * @returns Promise<any>
47 50
      */
48 51
     static switchChannel(channelName: string, token?: string): Promise<any>;
49 52
     /**
@@ -54,6 +57,7 @@ declare class RtcEngine {
54 57
      *  Occurs mediaRelayStateChanged
55 58
      *  Occurs receivedChannelMediaRelay when peer channel received this message
56 59
      * @param config {@link ChannelMediaConfiguration}
60
+     * @returns Promise<any>
57 61
      */
58 62
     static startChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
59 63
     /**
@@ -63,6 +67,7 @@ declare class RtcEngine {
63 67
      * It will occurs event:
64 68
      *  Occurs mediaRelayStateChanged
65 69
      * @param config {@link ChannelMediaConfiguration}
70
+     * @returns Promise<any>
66 71
      */
67 72
     static removeChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
68 73
     /**
@@ -72,6 +77,7 @@ declare class RtcEngine {
72 77
      * It will occurs event:
73 78
      *  Occurs mediaRelayStateChanged
74 79
      * @param config {@link ChannelMediaConfiguration}
80
+     * @returns Promise<any>
75 81
      */
76 82
     static updateChannelMediaRelay(config: ChannelMediaConfiguration): Promise<any>;
77 83
     /**
@@ -81,6 +87,7 @@ declare class RtcEngine {
81 87
      * It will occurs event:
82 88
      *  Occurs mediaRelayStateChanged
83 89
      * @param config {@link ChannelMediaConfiguration}
90
+     * @returns Promise<any>
84 91
      */
85 92
     static stopChannelMediaRelay(): Promise<any>;
86 93
     /**
@@ -462,7 +469,7 @@ declare class RtcEngine {
462 469
      * @param smooth
463 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 474
      * check for mobile phone speaker enabled
468 475
      *
@@ -771,7 +778,7 @@ declare class RtcEngine {
771 778
      * @param options {@link ImageOption}
772 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 783
      * clear video watermarks
777 784
      *
@@ -1177,8 +1184,28 @@ declare class RtcEngine {
1177 1184
      *         console.log("your currrent camera", info);
1178 1185
      *      })
1179 1186
      * ```
1180
-     * @return Promise{cameraSupportInfo}>
1187
+     * @return Promise<{cameraSupportInfo}>
1181 1188
      */
1182 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 1211
 export default RtcEngine;

+ 44
- 5
lib/RtcEngine.native.js Dosyayı Görüntüle

@@ -18,6 +18,7 @@ class RtcEngine {
18 18
      * This method creates and start event observer. You should call this method once.
19 19
      * @example `RtcEngine.init(option)`
20 20
      * @param options Defines the property of the client, see {@link Option} for details.
21
+     * @returns any
21 22
      */
22 23
     static init(options) {
23 24
         Agora.init(options);
@@ -31,6 +32,7 @@ class RtcEngine {
31 32
      * @param uid
32 33
      * @param token
33 34
      * @param info
35
+     * @returns Promise<any>
34 36
      */
35 37
     static joinChannel(channelName, uid, token, info) {
36 38
         return Agora.joinChannel({ channelName, uid, token, info });
@@ -45,6 +47,7 @@ class RtcEngine {
45 47
      * Occurs joinChannelSuccess when achieve joining stage
46 48
      * @param channelName {@link string}
47 49
      * @param token {@link string}
50
+     * @returns Promise<any>
48 51
      */
49 52
     static switchChannel(channelName, token) {
50 53
         return Agora.switchChannel({ channelName, token });
@@ -57,6 +60,7 @@ class RtcEngine {
57 60
      *  Occurs mediaRelayStateChanged
58 61
      *  Occurs receivedChannelMediaRelay when peer channel received this message
59 62
      * @param config {@link ChannelMediaConfiguration}
63
+     * @returns Promise<any>
60 64
      */
61 65
     static startChannelMediaRelay(config) {
62 66
         return Agora.startChannelMediaRelay(config);
@@ -68,6 +72,7 @@ class RtcEngine {
68 72
      * It will occurs event:
69 73
      *  Occurs mediaRelayStateChanged
70 74
      * @param config {@link ChannelMediaConfiguration}
75
+     * @returns Promise<any>
71 76
      */
72 77
     static removeChannelMediaRelay(config) {
73 78
         return Agora.removeChannelMediaRelay(config);
@@ -79,6 +84,7 @@ class RtcEngine {
79 84
      * It will occurs event:
80 85
      *  Occurs mediaRelayStateChanged
81 86
      * @param config {@link ChannelMediaConfiguration}
87
+     * @returns Promise<any>
82 88
      */
83 89
     static updateChannelMediaRelay(config) {
84 90
         return Agora.updateChannelMediaRelay(config);
@@ -90,6 +96,7 @@ class RtcEngine {
90 96
      * It will occurs event:
91 97
      *  Occurs mediaRelayStateChanged
92 98
      * @param config {@link ChannelMediaConfiguration}
99
+     * @returns Promise<any>
93 100
      */
94 101
     static stopChannelMediaRelay() {
95 102
         return Agora.stopChannelMediaRelay();
@@ -634,8 +641,8 @@ class RtcEngine {
634 641
      * @param smooth
635 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 648
      * check for mobile phone speaker enabled
@@ -1021,8 +1028,8 @@ class RtcEngine {
1021 1028
      * @param options {@link ImageOption}
1022 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 1035
      * clear video watermarks
@@ -1509,13 +1516,45 @@ class RtcEngine {
1509 1516
      *         console.log("your currrent camera", info);
1510 1517
      *      })
1511 1518
      * ```
1512
-     * @return Promise{cameraSupportInfo}>
1519
+     * @return Promise<{cameraSupportInfo}>
1513 1520
      */
1514 1521
     static getCameraInfo() {
1515 1522
         return tslib_1.__awaiter(this, void 0, void 0, function* () {
1516 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 1560
  * @ignore eventTypes

+ 1
- 1
lib/RtcEngine.native.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 15
- 5
lib/types.d.ts Dosyayı Görüntüle

@@ -204,6 +204,7 @@ export interface VideoOption {
204 204
 }
205 205
 export interface AudioRecordingOption {
206 206
     filepath: String;
207
+    sampleRate: number;
207 208
     quality: number;
208 209
 }
209 210
 export declare type Callback<T> = (err: any, data: any) => T;
@@ -248,11 +249,19 @@ export interface MixedAudioFrameOption {
248 249
     samplesPerCall: number;
249 250
 }
250 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 266
 export interface VideoStreamOption {
258 267
     uid: number;
@@ -322,4 +331,5 @@ export interface LastmileProbeConfig {
322 331
  */
323 332
 export interface CameraCapturerConfiguration {
324 333
     preference: number;
334
+    cameraDirection: number;
325 335
 }

+ 1
- 1
package.json Dosyayı Görüntüle

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

+ 2
- 7
react-native-agora.podspec Dosyayı Görüntüle

@@ -9,16 +9,11 @@ Pod::Spec.new do |s|
9 9
     s.homepage       = package['homepage']
10 10
     s.license        = package['license']
11 11
     s.authors        = package["authors"]
12
-    s.platform       = :ios, "7.0"
12
+    s.platform       = :ios, "8.0"
13 13
 
14 14
     s.source         = { :git => package["repository"]["url"] }
15 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 17
     s.dependency 'React'
23
-    s.dependency "AgoraRtcEngine_iOS", "2.9"
18
+    s.dependency "AgoraRtcEngine_iOS", "2.9.1"
24 19
 end

+ 34
- 5
src/RtcEngine.native.ts Dosyayı Görüntüle

@@ -728,8 +728,8 @@ class RtcEngine {
728 728
      * @param smooth
729 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,8 +1154,8 @@ class RtcEngine {
1154 1154
      * @param options {@link ImageOption}
1155 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,11 +1685,40 @@ class RtcEngine {
1685 1685
      *         console.log("your currrent camera", info);
1686 1686
      *      })
1687 1687
      * ```
1688
-     * @return Promise{cameraSupportInfo}>
1688
+     * @return Promise<{cameraSupportInfo}>
1689 1689
      */
1690 1690
     static async getCameraInfo(): Promise<any> {
1691 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 1724
 export default RtcEngine;

+ 15
- 5
src/types.ts Dosyayı Görüntüle

@@ -222,6 +222,7 @@ export interface VideoOption {
222 222
 
223 223
 export interface AudioRecordingOption {
224 224
   filepath: String,
225
+  sampleRate: number,
225 226
   quality: number
226 227
 }
227 228
 
@@ -276,11 +277,19 @@ export interface MixedAudioFrameOption {
276 277
 }
277 278
 
278 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 295
 export interface VideoStreamOption {
@@ -361,4 +370,5 @@ export interface LastmileProbeConfig {
361 370
  */
362 371
 export interface CameraCapturerConfiguration {
363 372
   preference: number
373
+  cameraDirection: number
364 374
 }