Browse Source

deprecate. &

matrixbirds 5 years ago
parent
commit
791b653868

+ 0
- 43
android/src/main/java/com/syan/agora/AgoraModule.java View File

1505
         AgoraManager.getInstance().mRtcEngine.muteLocalAudioStream(enabled);
1505
         AgoraManager.getInstance().mRtcEngine.muteLocalAudioStream(enabled);
1506
     }
1506
     }
1507
 
1507
 
1508
-    @ReactMethod
1509
-    public void createDataStream(ReadableMap options, Promise promise) {
1510
-        try {
1511
-            int res = AgoraManager.getInstance().mRtcEngine
1512
-                    .createDataStream(
1513
-                            options.getBoolean("ordered"),
1514
-                            options.getBoolean("reliable")
1515
-                            );
1516
-            if (res != 0) throw new ReactNativeAgoraException("adjustPlaybackSignalVolume Failed", res);
1517
-            WritableMap map = Arguments.createMap();
1518
-            map.putBoolean("success", true);
1519
-            map.putString("message", "createDataStream");
1520
-            promise.resolve(map);
1521
-        } catch(Exception e) {
1522
-            promise.reject(e);
1523
-        }
1524
-    }
1525
-
1526
     @ReactMethod
1508
     @ReactMethod
1527
     public void methodisSpeakerphoneEnabled(Callback callback) {
1509
     public void methodisSpeakerphoneEnabled(Callback callback) {
1528
         WritableMap map = Arguments.createMap();
1510
         WritableMap map = Arguments.createMap();
2465
         AgoraManager.getInstance().mRtcEngine.setLocalRenderMode(mode);
2447
         AgoraManager.getInstance().mRtcEngine.setLocalRenderMode(mode);
2466
     }
2448
     }
2467
 
2449
 
2468
-    // set remote video render mode
2469
-    @ReactMethod
2470
-    public void setRemoteRenderMode(int uid, int mode) {
2471
-        AgoraManager.getInstance().mRtcEngine.setRemoteRenderMode(uid, mode);
2472
-    }
2473
-
2474
-    @ReactMethod
2475
-    public void sendMessage(ReadableMap options, Promise promise) {
2476
-        try {
2477
-            boolean reliable = options.getBoolean("reliable");
2478
-            boolean ordered = options.getBoolean("ordered");
2479
-            String data = options.getString("data");
2480
-            int streamID = AgoraManager.getInstance().mRtcEngine.createDataStream(reliable, ordered);
2481
-            if (streamID < 0) throw new ReactNativeAgoraException("createDataStream Failed", streamID);
2482
-            int res = AgoraManager.getInstance().mRtcEngine.sendStreamMessage(streamID, data.getBytes(Charset.forName("UTF-8")));
2483
-            if (res != 0) throw new ReactNativeAgoraException("sendStreamMessage Failed", res);
2484
-            WritableMap map = Arguments.createMap();
2485
-            map.putBoolean("success", true);
2486
-            map.putInt("streamID", streamID);
2487
-            promise.resolve(map);
2488
-        } catch (Exception e) {
2489
-            promise.reject(e);
2490
-        }
2491
-    }
2492
-
2493
     @ReactMethod
2450
     @ReactMethod
2494
     public void getSdkVersion(Promise promise) {
2451
     public void getSdkVersion(Promise promise) {
2495
         try {
2452
         try {

+ 0
- 35
ios/RCTAgora/RCTAgora.m View File

464
   [self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth];
464
   [self.rtcEngine enableAudioVolumeIndication:interval smooth:smooth];
465
 }
465
 }
466
 
466
 
467
-RCT_EXPORT_METHOD(sendMessage
468
-                  :(NSDictionary *)options
469
-                  resolve:(RCTPromiseResolveBlock)resolve
470
-                  reject:(RCTPromiseRejectBlock)reject) {
471
-  NSInteger uid = 0;
472
-  if (options[@"streamID"] != nil) {
473
-    uid = [options[@"streamID"] integerValue];
474
-  }
475
-  NSInteger streamID = [self.rtcEngine createDataStream:&uid reliable:[options[@"reliable"] boolValue] ordered:[options[@"ordered"] boolValue]];
476
-  if (streamID < 0) {
477
-    reject(@"131001", @"createDataStream failed", [self makeNSError:@{
478
-                                                                      @"code": @(131001),
479
-                                                                      @"message":@{
480
-                                                                        @"success": @(NO),
481
-                                                                        @"value":[NSNumber numberWithInteger:uid]
482
-                                                                        }
483
-                                                                    }]);
484
-  }
485
-  NSString *dataStr = options[@"data"];
486
-  NSData *data = [dataStr dataUsingEncoding:NSUTF8StringEncoding];
487
-  NSInteger res = [self.rtcEngine sendStreamMessage:uid data:data];
488
-  if (res == 0) {
489
-    resolve(@{@"success": @(YES), @"streamID": @(uid)});
490
-  } else {
491
-    reject(@"131001", @"sendStreamMessage failed", [self makeNSError:@{
492
-                                                                       @"code": @(131001),
493
-                                                                       @"message":@{
494
-                                                                         @"success": @(NO),
495
-                                                                         @"value":[NSNumber numberWithInteger:res]
496
-                                                                         }
497
-                                                                     }]);
498
-  }
499
-}
500
-
501
-
502
 // is speaker phone enabled
467
 // is speaker phone enabled
503
 RCT_EXPORT_METHOD(methodisSpeakerphoneEnabled:(RCTResponseSenderBlock)callback) {
468
 RCT_EXPORT_METHOD(methodisSpeakerphoneEnabled:(RCTResponseSenderBlock)callback) {
504
   callback(@[@{@"status": @([self.rtcEngine isSpeakerphoneEnabled])}]);
469
   callback(@[@{@"status": @([self.rtcEngine isSpeakerphoneEnabled])}]);

+ 9
- 19
lib/RtcEngine.native.d.ts View File

1
-import { Option, Callback, 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, PlayEffectOption, AudioRecordingOption, AudioFrameOption, MixedAudioFrameOption, ImageOption, VideoStreamOption, DefaultVideoStreamOption, InjectStreamOption, RemoveInjectStreamOption, PublishStreamOption, RemovePublishStreamOption, LiveTranscodingOption, PositionOption, BeautyOption, LastmileProbeConfig, CameraCapturerConfiguration } from "./types";
2
 /**
2
 /**
3
  * RtcEngine is the javascript object for control agora native sdk through react native bridge.
3
  * RtcEngine is the javascript object for control agora native sdk through react native bridge.
4
  *
4
  *
242
      * @param smooth
242
      * @param smooth
243
      */
243
      */
244
     static enableAudioVolumeIndication(interval: number, smooth: number): void;
244
     static enableAudioVolumeIndication(interval: number, smooth: number): void;
245
-    /**
246
-     * create data stream
247
-     *
248
-     * This method creates data stream with options
249
-     *
250
-     * @param options {@link DataStreamOption}
251
-     */
252
-    static createDataStream(options: DataStreamOption): any;
253
     /**
245
     /**
254
      * check for mobile phone speaker enabled
246
      * check for mobile phone speaker enabled
255
      *
247
      *
617
      * @returns Promise<{success, value}>
609
      * @returns Promise<{success, value}>
618
      */
610
      */
619
     static removeInjectStreamUrl(options: RemoveInjectStreamOption): Promise<any>;
611
     static removeInjectStreamUrl(options: RemoveInjectStreamOption): Promise<any>;
612
+    /**
613
+     * @deprecated sendMessage
614
+     * sendMessage
615
+     */
616
+    /**
617
+     * @deprecated createDataStream
618
+     * createDataStream
619
+     */
620
     /**
620
     /**
621
      * @deprecated setupLocalVideo
621
      * @deprecated setupLocalVideo
622
      * setupLocalVideo
622
      * setupLocalVideo
759
      * @returns Promise<{success, value}>
759
      * @returns Promise<{success, value}>
760
      */
760
      */
761
     static setLog(filepath: string, level: number, maxfileSize: number): Promise<any>;
761
     static setLog(filepath: string, level: number, maxfileSize: number): Promise<any>;
762
-    /**
763
-     * send stream message
764
-     *
765
-     * This method sends stream message by specified uid
766
-     *
767
-     * @param uid
768
-     * @param data
769
-     * @returns Promise<{success, value}>
770
-     */
771
-    static sendMessage(streamID: number, data: any, reliable: boolean, ordered: boolean): Promise<any>;
772
     /**
762
     /**
773
      * add publish stream url
763
      * add publish stream url
774
      *
764
      *

+ 8
- 22
lib/RtcEngine.native.js View File

310
     static enableAudioVolumeIndication(interval, smooth) {
310
     static enableAudioVolumeIndication(interval, smooth) {
311
         Agora.enableAudioVolumeIndication(interval, smooth);
311
         Agora.enableAudioVolumeIndication(interval, smooth);
312
     }
312
     }
313
-    /**
314
-     * create data stream
315
-     *
316
-     * This method creates data stream with options
317
-     *
318
-     * @param options {@link DataStreamOption}
319
-     */
320
-    static createDataStream(options) {
321
-        return Agora.createDataStream(options);
322
-    }
323
     /**
313
     /**
324
      * check for mobile phone speaker enabled
314
      * check for mobile phone speaker enabled
325
      *
315
      *
781
     static removeInjectStreamUrl(options) {
771
     static removeInjectStreamUrl(options) {
782
         return Agora.removeInjectStreamUrl(options);
772
         return Agora.removeInjectStreamUrl(options);
783
     }
773
     }
774
+    /**
775
+     * @deprecated sendMessage
776
+     * sendMessage
777
+     */
778
+    /**
779
+     * @deprecated createDataStream
780
+     * createDataStream
781
+     */
784
     /**
782
     /**
785
      * @deprecated setupLocalVideo
783
      * @deprecated setupLocalVideo
786
      * setupLocalVideo
784
      * setupLocalVideo
953
     static setLog(filepath, level, maxfileSize) {
951
     static setLog(filepath, level, maxfileSize) {
954
         return Agora.setLog(filepath, level, maxfileSize);
952
         return Agora.setLog(filepath, level, maxfileSize);
955
     }
953
     }
956
-    /**
957
-     * send stream message
958
-     *
959
-     * This method sends stream message by specified uid
960
-     *
961
-     * @param uid
962
-     * @param data
963
-     * @returns Promise<{success, value}>
964
-     */
965
-    static sendMessage(streamID, data, reliable, ordered) {
966
-        return Agora.sendMessage({ streamID, data, reliable, ordered });
967
-    }
968
     /**
954
     /**
969
      * add publish stream url
955
      * add publish stream url
970
      *
956
      *

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


+ 10
- 24
src/RtcEngine.native.ts View File

374
         Agora.enableAudioVolumeIndication(interval, smooth);
374
         Agora.enableAudioVolumeIndication(interval, smooth);
375
     }
375
     }
376
 
376
 
377
-    /**
378
-     * create data stream
379
-     *
380
-     * This method creates data stream with options
381
-     *
382
-     * @param options {@link DataStreamOption}
383
-     */
384
-    public static createDataStream(options: DataStreamOption) {
385
-        return Agora.createDataStream(options);
386
-    }
387
-
388
     /**
377
     /**
389
      * check for mobile phone speaker enabled
378
      * check for mobile phone speaker enabled
390
      *
379
      *
893
         return Agora.removeInjectStreamUrl(options);
882
         return Agora.removeInjectStreamUrl(options);
894
     }
883
     }
895
 
884
 
885
+    /**
886
+     * @deprecated sendMessage
887
+     * sendMessage
888
+     */
889
+
890
+    /**
891
+     * @deprecated createDataStream
892
+     * createDataStream
893
+     */
894
+
896
     /**
895
     /**
897
      * @deprecated setupLocalVideo
896
      * @deprecated setupLocalVideo
898
      * setupLocalVideo 
897
      * setupLocalVideo 
1084
         return Agora.setLog(filepath, level, maxfileSize)
1083
         return Agora.setLog(filepath, level, maxfileSize)
1085
     }
1084
     }
1086
 
1085
 
1087
-    /**
1088
-     * send stream message
1089
-     *
1090
-     * This method sends stream message by specified uid
1091
-     *
1092
-     * @param uid
1093
-     * @param data
1094
-     * @returns Promise<{success, value}>
1095
-     */
1096
-    public static sendMessage(streamID: number, data: any, reliable: boolean, ordered: boolean): Promise<any> {
1097
-        return Agora.sendMessage({streamID, data, reliable, ordered});
1098
-    }
1099
-
1100
     /**
1086
     /**
1101
      * add publish stream url
1087
      * add publish stream url
1102
      *
1088
      *