Преглед изворни кода

fix. video render mode and release 2.4.0-alpha.5

matrixbirds пре 5 година
родитељ
комит
3f54f25723

+ 1
- 0
CHANGELOG Прегледај датотеку

@@ -6,6 +6,7 @@
6 6
 - support 2.4.0-alpha.2 using 0.55.1 as peerDependency and support typescript
7 7
 - support 2.4.0-alpha.3 bugfix iOS receiveStreamMessage data is null
8 8
 - support 2.4.0-alpha.4 bugfix iOS videoSizeChanged field rotation typo
9
+- support 2.4.0-alpha.5 bugfix Android & iOS side not support fit mode and hidden mode. Deprecate: setupLocalVideo & setupRemoteVideo
9 10
 
10 11
 #### 2.3.3-alpha
11 12
 - support agora video sdk 2.3.3

+ 27
- 11
android/src/main/java/com/syan/agora/AgoraManager.java Прегледај датотеку

@@ -173,24 +173,40 @@ public class AgoraManager {
173 173
     }
174 174
 
175 175
     /**
176
-     * 设置本地视频,即前置摄像头预览
176
+     * setupLocalVideo will render video from local side capture into ui layout
177 177
      */
178
-    public int setupLocalVideo() {
179
-        //创建一个SurfaceView用作视频预览
178
+    public int setupLocalVideo(Integer mode) {
180 179
         SurfaceView surfaceView = RtcEngine.CreateRendererView(context);
181
-        //将SurfaceView保存起来在SparseArray中,后续会将其加入界面。key为视频的用户id,这里是本地视频, 默认id是0
182
-
183 180
         mSurfaceViews.put(mLocalUid, surfaceView);
184
-
185
-        //设置本地视频,渲染模式选择VideoCanvas.RENDER_MODE_HIDDEN,如果选其他模式会出现视频不会填充满整个SurfaceView的情况,
186
-        //具体渲染模式参考官方文档https://docs.agora.io/cn/user_guide/API/android_api.html#set-local-video-view-setuplocalvideo
187
-        return mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, mLocalUid));
181
+        return mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, mode, mLocalUid));
188 182
     }
189 183
 
190
-    public int setupRemoteVideo(final int uid) {
184
+    /**
185
+     * setupRemoteVideo will render video from remote side capture into ui layout
186
+     */
187
+    public int setupRemoteVideo(final int uid, final Integer mode) {
191 188
         SurfaceView surfaceView = RtcEngine.CreateRendererView(context);
192 189
         mSurfaceViews.put(uid, surfaceView);
193
-        return mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_HIDDEN, uid));
190
+        return mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, mode, uid));
191
+    }
192
+
193
+    /**
194
+     * set local video render mode
195
+     * @param Integer renderMode
196
+     * @return result state
197
+     */
198
+    public int setLocalRenderMode(final Integer renderMode) {
199
+        return mRtcEngine.setLocalRenderMode(renderMode);
200
+    }
201
+
202
+    /**
203
+     * set remote video render mode
204
+     * @param Integer uid
205
+     * @param Integer renderMode
206
+     * @return result state
207
+     */
208
+    public int setRemoteRenderMode(final Integer uid, final Integer renderMode) {
209
+        return mRtcEngine.setRemoteRenderMode(uid, renderMode);
194 210
     }
195 211
 
196 212
     public int setEnableSpeakerphone(boolean enabled) {

+ 0
- 58
android/src/main/java/com/syan/agora/AgoraModule.java Прегледај датотеку

@@ -1188,33 +1188,6 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1188 1188
         RtcEngine.destroy();
1189 1189
     }
1190 1190
 
1191
-    @ReactMethod
1192
-    public void setupLocalVideo() {
1193
-        try {
1194
-            int res = AgoraManager.getInstance().setupLocalVideo();
1195
-            if (res != 0) throw new ReactNativeAgoraException("setupLocalVideo Failed", res);
1196
-        } catch (Exception e) {
1197
-            WritableMap err = Arguments.createMap();
1198
-            err.putBoolean("success", false);
1199
-            err.putString("message", e.toString());
1200
-            sendEvent(getReactApplicationContext(), "error", err);
1201
-        }
1202
-    }
1203
-
1204
-    @ReactMethod
1205
-    public void setupRemoteVideo(ReadableMap options) {
1206
-        try {
1207
-            int uid = options.getInt("uid");
1208
-            int res = AgoraManager.getInstance().setupRemoteVideo(uid);
1209
-            if (res != 0) throw new ReactNativeAgoraException("setupRemoteVideo Failed", res);
1210
-        } catch(Exception e) {
1211
-            WritableMap err = Arguments.createMap();
1212
-            err.putBoolean("success", false);
1213
-            err.putString("message", e.toString());
1214
-            sendEvent(getReactApplicationContext(), "error", err);
1215
-        }
1216
-    }
1217
-
1218 1191
     @ReactMethod
1219 1192
     public void startPreview() {
1220 1193
         AgoraManager.getInstance().startPreview();
@@ -1814,22 +1787,6 @@ public class AgoraModule extends ReactContextBaseJavaModule {
1814 1787
         }
1815 1788
     }
1816 1789
 
1817
-//  deprecated
1818
-//    @ReactMethod
1819
-//    public void startEchoTest(Promise promise) {
1820
-//        try {
1821
-//            int res = AgoraManager.getInstance().mRtcEngine
1822
-//                    .startEchoTest();
1823
-//            if (res != 0) throw new ReactNativeAgoraException("startEchoTest Failed", res);
1824
-//            WritableMap map = Arguments.createMap();
1825
-//            map.putBoolean("success", true);
1826
-//            map.putInt("value", res);
1827
-//            promise.resolve(map);
1828
-//        } catch (Exception e) {
1829
-//            promise.reject("131009", e);
1830
-//        }
1831
-//    }
1832
-
1833 1790
     @ReactMethod
1834 1791
     public void stopEchoTest(Promise promise) {
1835 1792
         try {
@@ -2507,21 +2464,6 @@ public class AgoraModule extends ReactContextBaseJavaModule {
2507 2464
         }
2508 2465
     }
2509 2466
 
2510
-//    deprecated
2511
-//    @ReactMethod
2512
-//    public void setVideoQualityParameters(boolean quality, Promise promise) {
2513
-//        try {
2514
-//            int res = AgoraManager.getInstance().mRtcEngine.setVideoQualityParameters(quality);
2515
-//            if (res != 0) throw new ReactNativeAgoraException("sendStreamMessage Failed", res);
2516
-//            WritableMap map = Arguments.createMap();
2517
-//            map.putBoolean("success", true);
2518
-//            map.putInt("value", res);
2519
-//            promise.resolve(map);
2520
-//        } catch (Exception e) {
2521
-//            promise.reject(e);
2522
-//        }
2523
-//    }
2524
-
2525 2467
     @ReactMethod
2526 2468
     public void setLocalVideoMirrorMode(int mode, Promise promise) {
2527 2469
         try {

+ 1
- 1
android/src/main/java/com/syan/agora/AgoraPackage.java Прегледај датотеку

@@ -26,7 +26,7 @@ public class AgoraPackage implements ReactPackage {
26 26
     @Override
27 27
     public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
28 28
         return Arrays.<ViewManager>asList(
29
-                new AgoraViewManage()
29
+                new AgoraViewManager()
30 30
         );
31 31
     }
32 32
 }

+ 53
- 0
android/src/main/java/com/syan/agora/AgoraVideoView.java Прегледај датотеку

@@ -2,13 +2,55 @@ package com.syan.agora;
2 2
 
3 3
 import android.content.Context;
4 4
 import android.util.AttributeSet;
5
+import android.view.SurfaceView;
6
+import android.view.View;
5 7
 import android.widget.LinearLayout;
6 8
 
9
+import io.agora.rtc.mediaio.AgoraSurfaceView;
10
+
7 11
 /**
8 12
  * Created by DB on 2017/6/27.
9 13
  */
10 14
 
11 15
 public class AgoraVideoView extends LinearLayout {
16
+    public boolean isShowLocalVideo() {
17
+        return showLocalVideo;
18
+    }
19
+
20
+    public void setShowLocalVideo(boolean showLocalVideo) {
21
+        this.showLocalVideo = showLocalVideo;
22
+    }
23
+
24
+    public Integer getRenderMode() {
25
+        return renderMode;
26
+    }
27
+
28
+    public void setRenderMode(Integer renderMode) {
29
+        this.renderMode = renderMode;
30
+
31
+    }
32
+
33
+    public Integer getRemoteUid() {
34
+        return remoteUid;
35
+    }
36
+
37
+    public void setRemoteUid(Integer remoteUid) {
38
+        this.remoteUid = remoteUid;
39
+    }
40
+
41
+    public boolean getZOrderMediaOverlay() {
42
+        return zOrderMediaOverlay;
43
+    }
44
+
45
+    public void setZOrderMediaOverlay(boolean zOrderMediaOverlay) {
46
+        this.zOrderMediaOverlay = zOrderMediaOverlay;
47
+    }
48
+
49
+    private boolean showLocalVideo;
50
+    private Integer renderMode = 1;
51
+    private Integer remoteUid;
52
+    private boolean zOrderMediaOverlay;
53
+    private SurfaceView surfaceView;
12 54
 
13 55
     public AgoraVideoView(Context context) {
14 56
         super(context);
@@ -22,4 +64,15 @@ public class AgoraVideoView extends LinearLayout {
22 64
     public AgoraVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
23 65
         super(context, attrs, defStyleAttr);
24 66
     }
67
+
68
+    protected void onVisibilityChanged(View changedView, int visibility) {
69
+        super.onVisibilityChanged(changedView, visibility);
70
+        if (changedView == this) {
71
+            if (null != remoteUid) {
72
+                AgoraManager.getInstance().setRemoteRenderMode(remoteUid, renderMode);
73
+            } else {
74
+                AgoraManager.getInstance().setLocalRenderMode(renderMode);
75
+            }
76
+        }
77
+    }
25 78
 }

+ 0
- 53
android/src/main/java/com/syan/agora/AgoraViewManage.java Прегледај датотеку

@@ -1,53 +0,0 @@
1
-package com.syan.agora;
2
-
3
-import android.view.SurfaceView;
4
-
5
-import com.facebook.react.uimanager.SimpleViewManager;
6
-import com.facebook.react.uimanager.ThemedReactContext;
7
-import com.facebook.react.uimanager.annotations.ReactProp;
8
-
9
-/**
10
- * Created by DB on 2017/6/23.
11
- */
12
-
13
-public class AgoraViewManage extends SimpleViewManager<AgoraVideoView> {
14
-
15
-    public static final String REACT_CLASS = "RCTAgoraView";
16
-
17
-    public SurfaceView surfaceView;
18
-
19
-    @Override
20
-    public String getName() {
21
-        return REACT_CLASS;
22
-    }
23
-
24
-    @Override
25
-    protected AgoraVideoView createViewInstance(ThemedReactContext reactContext) {
26
-        return new AgoraVideoView(reactContext);
27
-    }
28
-
29
-    @ReactProp(name = "showLocalVideo")
30
-    public void setShowLocalVideo(final AgoraVideoView agoraVideoView, boolean showLocalVideo) {
31
-
32
-        AgoraManager.getInstance().setupLocalVideo();
33
-        surfaceView = AgoraManager.getInstance().getLocalSurfaceView();
34
-        //surfaceView.setVisibility(View.VISIBLE);
35
-        agoraVideoView.addView(surfaceView);
36
-//        surfaceView.setZOrderMediaOverlay(true);
37
-
38
-    }
39
-
40
-    @ReactProp(name = "zOrderMediaOverlay")
41
-    public void setZOrderMediaOverlay(final AgoraVideoView agoraVideoView, boolean zOrderMediaOverlay) {
42
-        surfaceView.setZOrderMediaOverlay(zOrderMediaOverlay);
43
-    }
44
-
45
-    @ReactProp(name = "remoteUid")
46
-    public void setRemoteUid(final AgoraVideoView agoraVideoView, final int remoteUid) {
47
-        AgoraManager.getInstance().setupRemoteVideo(remoteUid);
48
-        surfaceView = AgoraManager.getInstance().getSurfaceView(remoteUid);
49
-        //surfaceView.setVisibility(View.VISIBLE);
50
-        agoraVideoView.addView(surfaceView);
51
-//        surfaceView.setZOrderMediaOverlay(true);
52
-    }
53
-}

+ 61
- 0
android/src/main/java/com/syan/agora/AgoraViewManager.java Прегледај датотеку

@@ -0,0 +1,61 @@
1
+package com.syan.agora;
2
+
3
+import android.view.SurfaceView;
4
+
5
+import com.facebook.react.uimanager.SimpleViewManager;
6
+import com.facebook.react.uimanager.ThemedReactContext;
7
+import com.facebook.react.uimanager.annotations.ReactProp;
8
+
9
+/**
10
+ * Created by DB on 2017/6/23.
11
+ */
12
+
13
+public class AgoraViewManager extends SimpleViewManager<AgoraVideoView> {
14
+
15
+    public static final String REACT_CLASS = "RCTAgoraVideoView";
16
+
17
+    public SurfaceView surfaceView;
18
+
19
+    @Override
20
+    public String getName() {
21
+        return REACT_CLASS;
22
+    }
23
+
24
+    @Override
25
+    protected AgoraVideoView createViewInstance(ThemedReactContext reactContext) {
26
+        return new AgoraVideoView(reactContext);
27
+    }
28
+
29
+    @ReactProp(name = "mode")
30
+    public void setRenderMode(final AgoraVideoView agoraVideoView, Integer renderMode) {
31
+        agoraVideoView.setRenderMode(renderMode);
32
+    }
33
+
34
+    @ReactProp(name = "showLocalVideo")
35
+    public void setShowLocalVideo(final AgoraVideoView agoraVideoView, boolean showLocalVideo) {
36
+        agoraVideoView.setShowLocalVideo(showLocalVideo);
37
+        if (showLocalVideo) {
38
+            AgoraManager.getInstance().setupLocalVideo(agoraVideoView.getRenderMode());
39
+            surfaceView = AgoraManager.getInstance().getLocalSurfaceView();
40
+            surfaceView.setZOrderMediaOverlay(agoraVideoView.getZOrderMediaOverlay());
41
+            agoraVideoView.addView(surfaceView);
42
+        }
43
+    }
44
+
45
+    @ReactProp(name = "zOrderMediaOverlay")
46
+    public void setZOrderMediaOverlay(final AgoraVideoView agoraVideoView, boolean zOrderMediaOverlay) {
47
+        surfaceView.setZOrderMediaOverlay(zOrderMediaOverlay);
48
+    }
49
+
50
+    @ReactProp(name = "remoteUid")
51
+    public void setRemoteUid(final AgoraVideoView agoraVideoView, final int remoteUid) {
52
+        agoraVideoView.setRemoteUid(remoteUid);
53
+        if (remoteUid > 0) {
54
+            AgoraManager.getInstance().setupRemoteVideo(remoteUid, agoraVideoView.getRenderMode());
55
+            surfaceView = AgoraManager.getInstance().getSurfaceView(remoteUid);
56
+            surfaceView.setZOrderMediaOverlay(agoraVideoView.getZOrderMediaOverlay());
57
+            agoraVideoView.addView(surfaceView);
58
+        }
59
+    }
60
+
61
+}

+ 0
- 39
ios/RCTAgora/RCTAgora.m Прегледај датотеку

@@ -146,7 +146,6 @@ RCT_EXPORT_MODULE();
146 146
 // init
147 147
 RCT_EXPORT_METHOD(init:(NSDictionary *)options) {
148 148
   [self startObserving];
149
-  NSLog(@"startObserving events");
150 149
   [AgoraConst share].appid = options[@"appid"];
151 150
   
152 151
   self.rtcEngine = [AgoraRtcEngineKit sharedEngineWithAppId:options[@"appid"] delegate:self];
@@ -313,24 +312,6 @@ RCT_EXPORT_METHOD(destroy) {
313 312
   [AgoraRtcEngineKit destroy];
314 313
 }
315 314
 
316
-// set local video canvas
317
-RCT_EXPORT_METHOD(setupLocalVideo:(NSDictionary *)options){
318
-  AgoraRtcVideoCanvas *canvas = [AgoraRtcVideoCanvas new];
319
-  canvas.uid = [AgoraConst share].localUid;
320
-  canvas.view = [self.bridge.uiManager viewForReactTag:options[@"reactTag"]];
321
-  canvas.renderMode = [options[@"renderMode"] integerValue];
322
-  [self.rtcEngine setupLocalVideo:canvas];
323
-}
324
-
325
-// set remote video canvas
326
-RCT_EXPORT_METHOD(setupRemoteVideo:(NSDictionary *) options) {
327
-  AgoraRtcVideoCanvas *canvas = [AgoraRtcVideoCanvas new];
328
-  canvas.uid = [options[@"uid"] integerValue];
329
-  canvas.view = [self.bridge.uiManager viewForReactTag:options[@"reactTag"]];
330
-  canvas.renderMode = [options[@"renderMode"] integerValue];
331
-  [self.rtcEngine setupRemoteVideo:canvas];
332
-}
333
-
334 315
 // set local video render mode
335 316
 RCT_EXPORT_METHOD(setLocalRenderMode:(NSInteger) mode) {
336 317
   [self.rtcEngine setLocalRenderMode:mode];
@@ -1391,26 +1372,6 @@ RCT_EXPORT_METHOD(removeInjectStreamUrl
1391 1372
   }
1392 1373
 }
1393 1374
 
1394
-// deprecated
1395
-// set video quality
1396
-//RCT_EXPORT_METHOD(setVideoQualityParameters
1397
-//                  :(BOOL) quality
1398
-//                  resolve:(RCTPromiseResolveBlock)resolve
1399
-//                  reject:(RCTPromiseRejectBlock)reject) {
1400
-//  NSInteger res = [self.rtcEngine setVideoQualityParameters:quality];
1401
-//  if (res == 0) {
1402
-//    resolve(@{@"success": @(YES)});
1403
-//  } else {
1404
-//    reject(@"131033", @"setVideoQualityParameters failed", [self makeNSError:@{
1405
-//                                                                               @"code": @(131033),
1406
-//                                                                               @"message":@{
1407
-//                                                                                   @"success": @(NO),
1408
-//                                                                                   @"value":[NSNumber numberWithInteger:res]
1409
-//                                                                                   }
1410
-//                                                                               }]);
1411
-//  }
1412
-//}
1413
-
1414 1375
 // set local video mirror mode
1415 1376
 RCT_EXPORT_METHOD(setLocalVideoMirrorMode
1416 1377
                   :(NSInteger) mode

+ 1
- 1
ios/RCTAgora/RCTAgoraVideoView.h Прегледај датотеку

@@ -12,8 +12,8 @@
12 12
 @interface RCTAgoraVideoView : UIView
13 13
 
14 14
 @property (strong, nonatomic) AgoraRtcEngineKit *rtcEngine;
15
-
16 15
 @property (nonatomic) BOOL showLocalVideo;
17 16
 @property (nonatomic) NSInteger remoteUid;
17
+@property (nonatomic) NSInteger renderMode;
18 18
 
19 19
 @end

+ 25
- 7
ios/RCTAgora/RCTAgoraVideoView.m Прегледај датотеку

@@ -7,6 +7,7 @@
7 7
 //
8 8
 
9 9
 #import "RCTAgoraVideoView.h"
10
+#import <React/RCTBridgeModule.h>
10 11
 
11 12
 @implementation RCTAgoraVideoView
12 13
 
@@ -14,28 +15,45 @@
14 15
   
15 16
   if (self == [super init]) {
16 17
     _rtcEngine = [AgoraConst share].rtcEngine;
18
+    _renderMode = AgoraVideoRenderModeHidden;
17 19
   }
18 20
   
19 21
   return self;
20 22
 }
21 23
 
24
+- (void)setRenderMode:(NSInteger)renderMode {
25
+  _renderMode = renderMode;
26
+}
27
+
22 28
 - (void)setShowLocalVideo:(BOOL)showLocalVideo {
23
-  if (showLocalVideo) {
24
-    AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
29
+  _showLocalVideo = showLocalVideo;
30
+  AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
31
+  if (_showLocalVideo) {
25 32
     canvas.uid = [AgoraConst share].localUid;
26 33
     canvas.view = self;
27
-    canvas.renderMode = AgoraVideoRenderModeHidden;
34
+    canvas.renderMode = _renderMode;
28 35
     [_rtcEngine setupLocalVideo:canvas];
29 36
   }
30 37
 }
31 38
 
32 39
 -(void)setRemoteUid:(NSInteger)remoteUid {
33
-  if (remoteUid > 0) {
34
-    AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
35
-    canvas.uid = remoteUid;
40
+  _remoteUid = remoteUid;
41
+  AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
42
+  if (_remoteUid > 0) {
43
+    canvas.uid = _remoteUid;
36 44
     canvas.view = self;
37
-    canvas.renderMode = AgoraVideoRenderModeHidden;
45
+    canvas.renderMode = _renderMode;
38 46
     [_rtcEngine setupRemoteVideo:canvas];
47
+    return;
48
+  }
49
+}
50
+
51
+-(void) willMoveToSuperview:(UIView *)newSuperview {
52
+  [super willMoveToSuperview:newSuperview];
53
+  if (_remoteUid > 0) {
54
+    [_rtcEngine setRemoteRenderMode:_remoteUid mode:_renderMode];
55
+  } else {
56
+    [_rtcEngine setLocalRenderMode:_renderMode];
39 57
   }
40 58
 }
41 59
 

+ 12
- 3
ios/RCTAgora/RCTAgoraViewManager.m Прегледај датотеку

@@ -11,10 +11,19 @@
11 11
 
12 12
 @implementation RCTAgoraViewManager
13 13
 
14
-RCT_EXPORT_MODULE()
14
+RCT_EXPORT_MODULE(RCTAgoraVideoView)
15 15
 
16
-RCT_EXPORT_VIEW_PROPERTY(showLocalVideo, BOOL)
17
-RCT_EXPORT_VIEW_PROPERTY(remoteUid, NSInteger)
16
+RCT_CUSTOM_VIEW_PROPERTY(mode, NSInteger, RCTAgoraVideoView) {
17
+  view.renderMode = [RCTConvert NSInteger:json];
18
+}
19
+
20
+RCT_CUSTOM_VIEW_PROPERTY(showLocalVideo, BOOL, RCTAgoraVideoView) {
21
+  view.showLocalVideo = [RCTConvert BOOL:json];
22
+}
23
+
24
+RCT_CUSTOM_VIEW_PROPERTY(remoteUid, NSInteger, RCTAgoraVideoView) {
25
+  view.remoteUid = [RCTConvert NSInteger:json];
26
+}
18 27
 
19 28
 - (UIView *)view {
20 29
   return [RCTAgoraVideoView new];

+ 6
- 0
lib/AgoraView.native.d.ts Прегледај датотеку

@@ -6,6 +6,12 @@ import { AgoraViewProps } from "./types";
6 6
  * This class is used to rendering native sdk stream
7 7
  *
8 8
  * @props {@link AgoraViewProps}
9
+ *
10
+ * @descrption AgoraViewProps has four properties.
11
+ * @property number: mode, this property will setup video render mode. there is two avaliable mode {hidden: 1, fit: 2}, you could see more details [https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#ac08882c4d0ec47b329900df169493673](#here)
12
+ * @property boolean: showLocalVideo, this property will render local video, NOTICE: IF YOU SET showLocalVideo YOU CANNOT SET remoteUid
13
+ * @property number: remoteUid, this property will render video with remote uid, NOTICE: IF YOU SET remoteUid YOU CANNOT SET showLocalVideo
14
+ * @property boolean: zOrderMediaOverlay, this property will working for android side and it likes zIndex behaviour on web side.
9 15
  */
10 16
 export default class AgoraView extends React.Component<AgoraViewProps> {
11 17
     /**

+ 7
- 1
lib/AgoraView.native.js Прегледај датотеку

@@ -8,13 +8,19 @@ const react_native_1 = require("react-native");
8 8
  *
9 9
  * This @object is used to bridge native layer between react layer.
10 10
  */
11
-const RCTAgoraView = react_native_1.requireNativeComponent("RCTAgoraView");
11
+const RCTAgoraView = react_native_1.requireNativeComponent("RCTAgoraVideoView");
12 12
 /**
13 13
  * AgoraView is the render layer for rendering video stream
14 14
  *
15 15
  * This class is used to rendering native sdk stream
16 16
  *
17 17
  * @props {@link AgoraViewProps}
18
+ *
19
+ * @descrption AgoraViewProps has four properties.
20
+ * @property number: mode, this property will setup video render mode. there is two avaliable mode {hidden: 1, fit: 2}, you could see more details [https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#ac08882c4d0ec47b329900df169493673](#here)
21
+ * @property boolean: showLocalVideo, this property will render local video, NOTICE: IF YOU SET showLocalVideo YOU CANNOT SET remoteUid
22
+ * @property number: remoteUid, this property will render video with remote uid, NOTICE: IF YOU SET remoteUid YOU CANNOT SET showLocalVideo
23
+ * @property boolean: zOrderMediaOverlay, this property will working for android side and it likes zIndex behaviour on web side.
18 24
  */
19 25
 class AgoraView extends react_1.default.Component {
20 26
     /**

+ 1
- 1
lib/AgoraView.native.js.map Прегледај датотеку

@@ -1 +1 @@
1
-{"version":3,"file":"AgoraView.native.js","sourceRoot":"","sources":["../src/AgoraView.native.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,+CAEqB;AAMrB;;;;GAIG;AAEH,MAAM,YAAY,GAAG,qCAAsB,CAAC,cAAc,CAAC,CAAC;AAE5D;;;;;;GAMG;AACH,MAAqB,SAAU,SAAQ,eAAK,CAAC,SAAyB;IAClE;;;;OAIG;IACI,MAAM;QACT,OAAO,CACH,8BAAC,YAAY,oBAAM,IAAI,CAAC,YAAY,EAAE,EAAK,CAC9C,CAAA;IACL,CAAC;IAED;;;;OAIG;IACK,YAAY;QAChB,IAAI,SAAS,GAAG,EAAoB,CAAC;QACrC,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YACxB,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAxBD,4BAwBC"}
1
+{"version":3,"file":"AgoraView.native.js","sourceRoot":"","sources":["../src/AgoraView.native.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,+CAEqB;AAMrB;;;;GAIG;AAEH,MAAM,YAAY,GAAG,qCAAsB,CAAC,mBAAmB,CAAC,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,MAAqB,SAAU,SAAQ,eAAK,CAAC,SAAyB;IAClE;;;;OAIG;IACI,MAAM;QACT,OAAO,CACH,8BAAC,YAAY,oBAAM,IAAI,CAAC,YAAY,EAAE,EAAK,CAC9C,CAAA;IACL,CAAC;IAED;;;;OAIG;IACK,YAAY;QAChB,IAAI,SAAS,GAAG,EAAoB,CAAC;QACrC,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;YACxB,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACpC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAxBD,4BAwBC"}

+ 13
- 27
lib/RtcEngine.native.d.ts Прегледај датотеку

@@ -1,4 +1,4 @@
1
-import { Option, Callback, VideoOption, AudioMixingOption, DataStreamOption, PlayEffectOption, AudioRecordingOption, AudioFrameOption, MixedAudioFrameOption, ImageOption, VideoStreamOption, DefaultVideoStreamOption, InjectStreamOption, RemoveInjectStreamOption, PublishStreamOption, RemovePublishStreamOption, LiveTranscodingOption, PositionOption, BeautyOption, LastmileProbeConfig, CameraCapturerConfiguration } from "./types";
1
+import { Option, Callback, AudioMixingOption, DataStreamOption, PlayEffectOption, AudioRecordingOption, AudioFrameOption, MixedAudioFrameOption, ImageOption, VideoStreamOption, DefaultVideoStreamOption, InjectStreamOption, RemoveInjectStreamOption, PublishStreamOption, RemovePublishStreamOption, LiveTranscodingOption, PositionOption, BeautyOption, LastmileProbeConfig, CameraCapturerConfiguration } from "./types";
2 2
 /**
3 3
  * RtcEngine is the javascript object for control agora native sdk through react native bridge.
4 4
  *
@@ -98,20 +98,6 @@ declare class RtcEngine {
98 98
      * @returns Promise<{success, value}>
99 99
      */
100 100
     static destroy(): Promise<any>;
101
-    /**
102
-     * show local video
103
-     *
104
-     * This method calls native sdk render canvas for local video.
105
-     * @param options {@link VideoOption}
106
-     */
107
-    static setupLocalVideo(options: VideoOption): void;
108
-    /**
109
-     * show remote video
110
-     *
111
-     * This method calls native sdk render canvas for remote video.
112
-     * @param options {@link VideoOption}
113
-     */
114
-    static setupRemoteVideo(options: VideoOption): void;
115 101
     /**
116 102
      * set local video render mode
117 103
      *
@@ -513,11 +499,8 @@ declare class RtcEngine {
513 499
      */
514 500
     static setAudioSessionOperationRestriction(): void;
515 501
     /**
516
-     * @deprecated
517
-     * start echo test
518
-     *
519
-     * This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
520
-     * @returns Promise<{success, value}>
502
+     * @deprecated startEchoTest
503
+     * startEchoTest
521 504
      */
522 505
     /**
523 506
      * stop echo test
@@ -650,13 +633,16 @@ declare class RtcEngine {
650 633
      */
651 634
     static removeInjectStreamUrl(options: RemoveInjectStreamOption): Promise<any>;
652 635
     /**
653
-     * @deprecated
654
-     * set video quality
655
-     *
656
-     * This method sets the preferences for the video quality. (Live broadcast only).
657
-     *
658
-     * @param quality boolean
659
-     * @returns Promise<{success, value}>
636
+     * @deprecated setupLocalVideo
637
+     * setupLocalVideo
638
+     */
639
+    /**
640
+     * @deprecated setupRemoteVideo
641
+     * setupRemoteVideo
642
+     */
643
+    /**
644
+     * @deprecated setVideoQualityParameters
645
+     * setVideoQualityParameters
660 646
      */
661 647
     /**
662 648
      * set local video mirror mode

+ 12
- 36
lib/RtcEngine.native.js Прегледај датотеку

@@ -128,24 +128,6 @@ class RtcEngine {
128 128
     static destroy() {
129 129
         return Agora.destroy();
130 130
     }
131
-    /**
132
-     * show local video
133
-     *
134
-     * This method calls native sdk render canvas for local video.
135
-     * @param options {@link VideoOption}
136
-     */
137
-    static setupLocalVideo(options) {
138
-        Agora.setupLocalVideo(options);
139
-    }
140
-    /**
141
-     * show remote video
142
-     *
143
-     * This method calls native sdk render canvas for remote video.
144
-     * @param options {@link VideoOption}
145
-     */
146
-    static setupRemoteVideo(options) {
147
-        Agora.setupRemoteVideo(options);
148
-    }
149 131
     /**
150 132
      * set local video render mode
151 133
      *
@@ -659,15 +641,9 @@ class RtcEngine {
659 641
         Agora.setAudioSessionOperationRestriction();
660 642
     }
661 643
     /**
662
-     * @deprecated
663
-     * start echo test
664
-     *
665
-     * This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
666
-     * @returns Promise<{success, value}>
644
+     * @deprecated startEchoTest
645
+     * startEchoTest
667 646
      */
668
-    // public static startEchoTest(): Promise<any> {
669
-    //     return Agora.startEchoTest();
670
-    // }
671 647
     /**
672 648
      * stop echo test
673 649
      *
@@ -829,17 +805,17 @@ class RtcEngine {
829 805
         return Agora.removeInjectStreamUrl(options);
830 806
     }
831 807
     /**
832
-     * @deprecated
833
-     * set video quality
834
-     *
835
-     * This method sets the preferences for the video quality. (Live broadcast only).
836
-     *
837
-     * @param quality boolean
838
-     * @returns Promise<{success, value}>
808
+     * @deprecated setupLocalVideo
809
+     * setupLocalVideo
810
+     */
811
+    /**
812
+     * @deprecated setupRemoteVideo
813
+     * setupRemoteVideo
814
+     */
815
+    /**
816
+     * @deprecated setVideoQualityParameters
817
+     * setVideoQualityParameters
839 818
      */
840
-    // public static setVideoQualityParameters(quality: boolean): Promise<any> {
841
-    //     return Agora.setVideoQualityParameters(quality);
842
-    // }
843 819
     /**
844 820
      * set local video mirror mode
845 821
      *

+ 1
- 1
lib/RtcEngine.native.js.map
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 1
- 0
lib/types.d.ts Прегледај датотеку

@@ -122,6 +122,7 @@ export declare type Nullable<T> = T | null | undefined;
122 122
 export declare type String = Nullable<string>;
123 123
 export declare type Number = Nullable<number> | 0;
124 124
 export interface AgoraViewProps extends ViewProps {
125
+    mode: number;
125 126
     showLocalVideo: boolean;
126 127
     remoteUid: number;
127 128
     zOrderMediaOverlay: boolean;

+ 1
- 1
package.json Прегледај датотеку

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-agora",
3
-  "version": "2.4.0-alpha.4",
3
+  "version": "2.4.0-alpha.5",
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",

+ 1
- 1
react-native-agora.podspec Прегледај датотеку

@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
25 25
   #
26 26
 
27 27
   s.platform     = :ios
28
-  # s.platform     = :ios, "5.0"
28
+  s.platform     = :ios, "5.0"
29 29
 
30 30
   #  When using multiple platforms
31 31
   # s.ios.deployment_target = "5.0"

+ 7
- 1
src/AgoraView.native.tsx Прегледај датотеку

@@ -13,7 +13,7 @@ import {
13 13
  * This @object is used to bridge native layer between react layer.
14 14
  */
15 15
 
16
-const RCTAgoraView = requireNativeComponent("RCTAgoraView");
16
+const RCTAgoraView = requireNativeComponent("RCTAgoraVideoView");
17 17
 
18 18
 /**
19 19
  * AgoraView is the render layer for rendering video stream
@@ -21,6 +21,12 @@ const RCTAgoraView = requireNativeComponent("RCTAgoraView");
21 21
  * This class is used to rendering native sdk stream
22 22
  *
23 23
  * @props {@link AgoraViewProps}
24
+ * 
25
+ * @descrption AgoraViewProps has four properties.
26
+ * @property number: mode, this property will setup video render mode. there is two avaliable mode {hidden: 1, fit: 2}, you could see more details [https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#ac08882c4d0ec47b329900df169493673](#here)
27
+ * @property boolean: showLocalVideo, this property will render local video, NOTICE: IF YOU SET showLocalVideo YOU CANNOT SET remoteUid
28
+ * @property number: remoteUid, this property will render video with remote uid, NOTICE: IF YOU SET remoteUid YOU CANNOT SET showLocalVideo
29
+ * @property boolean: zOrderMediaOverlay, this property will working for android side and it likes zIndex behaviour on web side.
24 30
  */
25 31
 export default class AgoraView extends React.Component<AgoraViewProps> {
26 32
     /**

+ 16
- 39
src/RtcEngine.native.ts Прегледај датотеку

@@ -170,27 +170,6 @@ class RtcEngine {
170 170
         return Agora.destroy();
171 171
     }
172 172
 
173
-    /**
174
-     * show local video
175
-     *
176
-     * This method calls native sdk render canvas for local video.
177
-     * @param options {@link VideoOption}
178
-     */
179
-
180
-    public static setupLocalVideo(options: VideoOption) {
181
-        Agora.setupLocalVideo(options);
182
-    }
183
-
184
-    /**
185
-     * show remote video
186
-     *
187
-     * This method calls native sdk render canvas for remote video.
188
-     * @param options {@link VideoOption}
189
-     */
190
-    public static setupRemoteVideo(options: VideoOption) {
191
-        Agora.setupRemoteVideo(options);
192
-    }
193
-
194 173
     /**
195 174
      * set local video render mode
196 175
      *
@@ -760,15 +739,10 @@ class RtcEngine {
760 739
      }
761 740
 
762 741
     /**
763
-     * @deprecated
764
-     * start echo test
765
-     *
766
-     * This method launches an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
767
-     * @returns Promise<{success, value}>
742
+     * @deprecated startEchoTest
743
+     * startEchoTest
768 744
      */
769
-    // public static startEchoTest(): Promise<any> {
770
-    //     return Agora.startEchoTest();
771
-    // }
745
+
772 746
 
773 747
     /**
774 748
      * stop echo test
@@ -946,17 +920,20 @@ class RtcEngine {
946 920
     }
947 921
 
948 922
     /**
949
-     * @deprecated
950
-     * set video quality
951
-     *
952
-     * This method sets the preferences for the video quality. (Live broadcast only).
953
-     *
954
-     * @param quality boolean
955
-     * @returns Promise<{success, value}>
923
+     * @deprecated setupLocalVideo
924
+     * setupLocalVideo 
925
+     */
926
+
927
+    /**
928
+     * @deprecated setupRemoteVideo
929
+     * setupRemoteVideo 
930
+     */
931
+
932
+
933
+    /**
934
+     * @deprecated setVideoQualityParameters
935
+     * setVideoQualityParameters
956 936
      */
957
-    // public static setVideoQualityParameters(quality: boolean): Promise<any> {
958
-    //     return Agora.setVideoQualityParameters(quality);
959
-    // }
960 937
 
961 938
     /**
962 939
      * set local video mirror mode

+ 1
- 0
src/types.ts Прегледај датотеку

@@ -139,6 +139,7 @@ export type String = Nullable<string>;
139 139
 export type Number = Nullable<number> | 0;
140 140
 
141 141
 export interface AgoraViewProps extends ViewProps {
142
+  mode: number,
142 143
   showLocalVideo: boolean,
143 144
   remoteUid: number,
144 145
   zOrderMediaOverlay: boolean,