@byteplus/react-native-live-push 1.1.1 → 1.1.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,5 +88,5 @@ dependencies {
88
88
  //noinspection GradleDynamicVersion
89
89
  implementation "com.facebook.react:react-native:+"
90
90
  implementation "com.volcengine:VolcApiEngine:1.2.3"
91
- implementation 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.41.300.103'
91
+ api 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.41.300.103'
92
92
  }
@@ -0,0 +1,22 @@
1
+ package com.volcengine.velive.rn.push;
2
+
3
+ import com.ss.avframework.live.VeLivePusher;
4
+
5
+ import java.util.HashMap;
6
+
7
+ public class VeLivePushHelper {
8
+ private static final HashMap<String, VeLivePusher>
9
+ pusherMap = new HashMap<>();
10
+
11
+ public static void setVeLivePusher(String viewId, VeLivePusher pusher) {
12
+ pusherMap.put(viewId, pusher);
13
+ }
14
+
15
+ public static void removeVeLivePusher(String viewId) {
16
+ pusherMap.remove(viewId);
17
+ }
18
+
19
+ public static VeLivePusher getPusher(String viewId) {
20
+ return pusherMap.get(viewId);
21
+ }
22
+ }
@@ -16,6 +16,7 @@ import com.facebook.react.bridge.ReadableMap;
16
16
  import com.facebook.react.bridge.WritableMap;
17
17
  import com.facebook.react.modules.core.DeviceEventManagerModule;
18
18
 
19
+ import com.ss.avframework.live.VeLivePusher;
19
20
  import com.ss.avframework.live.VeLivePusherConfiguration;
20
21
  import com.ss.avframework.live.VeLivePusherDef;
21
22
  import com.ss.avframework.live.VeLivePusherObserver;
@@ -23,12 +24,16 @@ import com.ss.avframework.live.statistics.VeLivePusherStatisticsExt;
23
24
  import com.volcengine.VolcApiEngine.*;
24
25
  import com.volcengine.VolcApiEngine.view.*;
25
26
 
27
+ import java.util.WeakHashMap;
28
+
26
29
  public class VeLivePushModule extends VeLivePushModuleSpec implements IEventReceiver {
27
30
  static {
28
31
  JsonAbleClass.add(VeLivePusherStatisticsExt.class);
29
32
  }
30
33
 
31
34
  VolcApiEngine apiEngine = null;
35
+ private WeakHashMap<String, VeLivePusher> mPusherMap = new WeakHashMap<>();
36
+
32
37
 
33
38
  VeLivePushModule(ReactApplicationContext context) {
34
39
  super(context);
@@ -0,0 +1,25 @@
1
+ //
2
+ // VeLivePushHelper.h
3
+ // Pods
4
+ //
5
+ // Created by ByteDance on 2025/5/7.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ @class VeLivePusher;
13
+
14
+ @interface VeLivePushHelper : NSObject
15
+
16
+ + (nullable VeLivePusher *)getPusher:(NSString *)key;
17
+
18
+ + (void)setVeLivePusher:(VeLivePusher *)pusher forKey:(NSString *)key;
19
+
20
+ + (void)removeVeLivePusher:(NSString *)key;
21
+
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
25
+
@@ -0,0 +1,43 @@
1
+ //
2
+ // VeLivePushHelper.m
3
+ // Pods
4
+ //
5
+ // Created by ByteDance on 2025/5/7.
6
+ //
7
+
8
+ #import "VeLivePushHelper.h"
9
+ // 使用TTSDKFramework的VeLivePusher类,但在此不直接导入
10
+ // 在包含此SDK的项目中,VeLivePusher会被正确解析
11
+
12
+ @implementation VeLivePushHelper
13
+
14
+ static NSMapTable<NSString *, VeLivePusher *> *pusherMap;
15
+
16
+ + (void)initialize {
17
+ if (self == [VeLivePushHelper class]) {
18
+ pusherMap = [NSMapTable strongToWeakObjectsMapTable];
19
+ }
20
+ }
21
+
22
+ + (nullable VeLivePusher *)getPusher:(NSString *)key {
23
+ if (!key) {
24
+ return nil;
25
+ }
26
+ return [pusherMap objectForKey:key];
27
+ }
28
+
29
+ + (void)setVeLivePusher:(VeLivePusher *)pusher forKey:(NSString *)key {
30
+ if (!key || !pusher) {
31
+ return;
32
+ }
33
+ [pusherMap setObject:pusher forKey:key];
34
+ }
35
+
36
+ + (void)removeVeLivePusher:(NSString *)key {
37
+ if (!key) {
38
+ return;
39
+ }
40
+ [pusherMap removeObjectForKey:key];
41
+ }
42
+
43
+ @end
@@ -5,14 +5,13 @@
5
5
  // Created by ByteDance on 2024/4/10.
6
6
  //
7
7
 
8
- #import <UIKit/UIKit.h>
9
8
  #import <Foundation/Foundation.h>
9
+ #import <UIKit/UIKit.h>
10
10
 
11
11
  #import <TTSDKFramework/TTSDKFramework.h>
12
- #import <TTSDKFramework/TTSDKFramework/VeLiveMediaPlayer.h>
13
12
 
14
- #import "VolcApiEngine/VolcEventObserver.h"
15
13
  #import "VeLivePushSDK.h"
14
+ #import "VolcApiEngine/VolcEventObserver.h"
16
15
 
17
16
  #define EVENT_NAME @"VeLivePush:onEvent"
18
17
 
@@ -20,53 +19,54 @@
20
19
 
21
20
  @end
22
21
 
22
+ @interface RCTVeLivePushModule () <VeLiveMediaPlayerListener>
23
+
24
+ @end
25
+
23
26
  static RCTVeLivePushModule *instance = nil;
24
27
 
25
- @implementation RCTVeLivePushModule
26
- {
28
+ @implementation RCTVeLivePushModule {
27
29
  bool hasListeners;
28
30
  }
29
31
 
30
32
  + (instancetype)shareInstance {
31
- return instance;
33
+ return instance;
32
34
  }
33
35
 
34
36
  + (BOOL)requiresMainQueueSetup {
35
- return YES;
37
+ return YES;
36
38
  }
37
39
 
38
40
  + (void)_unsedForKeepOnly {
39
- Protocol *unused = @protocol(VeLivePlayerObserver);
40
- NSLog(@"Loaded Protocol: %p", unused);
41
+ Protocol *unused = @protocol(VeLivePlayerObserver);
42
+ NSLog(@"Loaded Protocol: %p", unused);
41
43
  }
42
44
 
43
45
  - (dispatch_queue_t)methodQueue {
44
- return dispatch_get_main_queue();
46
+ return dispatch_get_main_queue();
45
47
  }
46
48
 
47
49
  - (instancetype)init {
48
- self = [super init];
49
- if (self != nil) {
50
- self.apiEngine = nil;
51
- instance = self;
52
- }
53
- return instance;
50
+ self = [super init];
51
+ if (self != nil) {
52
+ self.apiEngine = nil;
53
+ instance = self;
54
+ }
55
+ return instance;
54
56
  }
55
57
 
56
58
  - (NSArray<NSString *> *)supportedEvents {
57
- return @[ EVENT_NAME ];
59
+ return @[ EVENT_NAME ];
58
60
  }
59
61
 
60
- - (void)onEvent:(NSString *)eventName data:(id)eventData
61
- {
62
- NSDictionary * dic = @{ @"event": eventName, @"data": eventData };
62
+ - (void)onEvent:(NSString *)eventName data:(id)eventData {
63
+ NSDictionary *dic = @{@"event" : eventName, @"data" : eventData};
63
64
  [self sendEventWithName:EVENT_NAME body:dic];
64
65
  }
65
66
 
66
67
  RCT_EXPORT_MODULE();
67
68
 
68
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine)
69
- {
69
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine) {
70
70
  if (self.apiEngine == nil) {
71
71
  self.apiEngine = [[VolcApiEngine alloc] init];
72
72
  [self.apiEngine setObserver:self];
@@ -74,36 +74,25 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(newApiEngine)
74
74
  return nil;
75
75
  }
76
76
 
77
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(destroyApiEngine)
78
- {
79
- //
77
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(destroyApiEngine) {
78
+ //
80
79
  return nil;
81
80
  }
82
81
 
83
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(callApiSync:(nonnull NSDictionary *) args)
84
- {
82
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(callApiSync
83
+ : (nonnull NSDictionary *)args) {
85
84
  [self newApiEngine];
86
85
  return [instance.apiEngine callApi:args];
87
86
  }
88
87
 
89
- RCT_EXPORT_METHOD(callApi:(nonnull NSDictionary *)args callback:(RCTResponseSenderBlock) callback)
90
- {
88
+ RCT_EXPORT_METHOD(callApi
89
+ : (nonnull NSDictionary *)args callback
90
+ : (RCTResponseSenderBlock)callback) {
91
91
  [self newApiEngine];
92
92
  dispatch_async(dispatch_get_main_queue(), ^{
93
93
  id _val = [self.apiEngine callApi:args];
94
- callback(@[_val]);
94
+ callback(@[ _val ]);
95
95
  });
96
96
  }
97
97
 
98
- RCT_EXPORT_METHOD(test)
99
- {
100
- Protocol *p = @protocol(VeLiveMediaPlayerListener);
101
- NSString *str = NSStringFromProtocol(p);
102
- NSLog(@"protocol name %@", str);
103
-
104
- Protocol *p2 = @protocol(VeLivePusherObserver);
105
- NSString *str2 = NSStringFromProtocol(p2);
106
- NSLog(@"protocol name %@", str2);
107
- }
108
-
109
98
  @end
@@ -0,0 +1,4 @@
1
+ module react_native_velive_push {
2
+ header "../VeLivePushHelper.h"
3
+ export *
4
+ }
@@ -12694,6 +12694,102 @@ var NativeUIView = function () {
12694
12694
  return UIView;
12695
12695
  })(NativeUIView));
12696
12696
 
12697
+ var VeLivePushHelper$1 = function () {
12698
+ var _classDecorators = [NativeClass('com.volcengine.velive.rn.push.VeLivePushHelper')];
12699
+ var _classDescriptor;
12700
+ var _classExtraInitializers = [];
12701
+ var _classThis;
12702
+ var _staticExtraInitializers = [];
12703
+ var _static_setVeLivePusher_decorators;
12704
+ var _static_removeVeLivePusher_decorators;
12705
+ var VeLivePushHelper = _classThis = /** @class */ (function () {
12706
+ function VeLivePushHelper_1() {
12707
+ }
12708
+ VeLivePushHelper_1.setPusher = function (viewId, pusher) {
12709
+ VeLivePushHelper.pusherMap.set(pusher, viewId);
12710
+ this.setVeLivePusher(viewId, pusher);
12711
+ };
12712
+ VeLivePushHelper_1.removePusher = function (pusher) {
12713
+ var viewId = VeLivePushHelper.pusherMap.get(pusher);
12714
+ if (viewId) {
12715
+ VeLivePushHelper.pusherMap.delete(pusher);
12716
+ this.removeVeLivePusher(viewId);
12717
+ }
12718
+ };
12719
+ VeLivePushHelper_1.setVeLivePusher = function (viewId, pusher) {
12720
+ throw new Error('');
12721
+ };
12722
+ VeLivePushHelper_1.removeVeLivePusher = function (viewId) {
12723
+ throw new Error('');
12724
+ };
12725
+ return VeLivePushHelper_1;
12726
+ }());
12727
+ __setFunctionName(_classThis, "VeLivePushHelper");
12728
+ (function () {
12729
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
12730
+ _static_setVeLivePusher_decorators = [NativeStaticMethodSync()];
12731
+ _static_removeVeLivePusher_decorators = [NativeStaticMethodSync()];
12732
+ __esDecorate(_classThis, null, _static_setVeLivePusher_decorators, { kind: "method", name: "setVeLivePusher", static: true, private: false, access: { has: function (obj) { return "setVeLivePusher" in obj; }, get: function (obj) { return obj.setVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12733
+ __esDecorate(_classThis, null, _static_removeVeLivePusher_decorators, { kind: "method", name: "removeVeLivePusher", static: true, private: false, access: { has: function (obj) { return "removeVeLivePusher" in obj; }, get: function (obj) { return obj.removeVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12734
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
12735
+ VeLivePushHelper = _classThis = _classDescriptor.value;
12736
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
12737
+ })();
12738
+ _classThis.pusherMap = (__runInitializers(_classThis, _staticExtraInitializers), new WeakMap());
12739
+ (function () {
12740
+ __runInitializers(_classThis, _classExtraInitializers);
12741
+ })();
12742
+ return VeLivePushHelper = _classThis;
12743
+ }();
12744
+
12745
+ var VeLivePushHelper = function () {
12746
+ var _classDecorators = [NativeClass('VeLivePushHelper')];
12747
+ var _classDescriptor;
12748
+ var _classExtraInitializers = [];
12749
+ var _classThis;
12750
+ var _staticExtraInitializers = [];
12751
+ var _static_setVeLivePusher_decorators;
12752
+ var _static_removeVeLivePusher_decorators;
12753
+ var VeLivePushHelper = _classThis = /** @class */ (function () {
12754
+ function VeLivePushHelper_1() {
12755
+ }
12756
+ VeLivePushHelper_1.setPusher = function (viewId, pusher) {
12757
+ VeLivePushHelper.pusherMap.set(pusher, viewId);
12758
+ this.setVeLivePusher(pusher, viewId);
12759
+ };
12760
+ VeLivePushHelper_1.removePusher = function (pusher) {
12761
+ var viewId = VeLivePushHelper.pusherMap.get(pusher);
12762
+ if (viewId) {
12763
+ VeLivePushHelper.pusherMap.delete(pusher);
12764
+ this.removeVeLivePusher(viewId);
12765
+ }
12766
+ };
12767
+ VeLivePushHelper_1.setVeLivePusher = function (pusher, viewId) {
12768
+ throw new Error('');
12769
+ };
12770
+ VeLivePushHelper_1.removeVeLivePusher = function (viewId) {
12771
+ throw new Error('');
12772
+ };
12773
+ return VeLivePushHelper_1;
12774
+ }());
12775
+ __setFunctionName(_classThis, "VeLivePushHelper");
12776
+ (function () {
12777
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
12778
+ _static_setVeLivePusher_decorators = [NativeStaticMethodSync('setVeLivePusher:forKey:')];
12779
+ _static_removeVeLivePusher_decorators = [NativeStaticMethodSync('removeVeLivePusher:')];
12780
+ __esDecorate(_classThis, null, _static_setVeLivePusher_decorators, { kind: "method", name: "setVeLivePusher", static: true, private: false, access: { has: function (obj) { return "setVeLivePusher" in obj; }, get: function (obj) { return obj.setVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12781
+ __esDecorate(_classThis, null, _static_removeVeLivePusher_decorators, { kind: "method", name: "removeVeLivePusher", static: true, private: false, access: { has: function (obj) { return "removeVeLivePusher" in obj; }, get: function (obj) { return obj.removeVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12782
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
12783
+ VeLivePushHelper = _classThis = _classDescriptor.value;
12784
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
12785
+ })();
12786
+ _classThis.pusherMap = (__runInitializers(_classThis, _staticExtraInitializers), new WeakMap());
12787
+ (function () {
12788
+ __runInitializers(_classThis, _classExtraInitializers);
12789
+ })();
12790
+ return VeLivePushHelper = _classThis;
12791
+ }();
12792
+
12697
12793
  /** {zh}
12698
12794
  * @detail keytype
12699
12795
  * @brief 推流本地文件录制配置。
@@ -17792,7 +17888,7 @@ var android_VeLivePusherObserver = /** @class */ (function (_super) {
17792
17888
  if (!this._instance['android_onScreenRecording']) {
17793
17889
  return;
17794
17890
  }
17795
- return this._instance['android_onScreenRecording']();
17891
+ return this._instance['android_onScreenRecording'](open);
17796
17892
  };
17797
17893
  android_VeLivePusherObserver.prototype.onNetworkQuality = function (quality) {
17798
17894
  if (!this._instance['onNetworkQuality']) {
@@ -23646,6 +23742,36 @@ var VeLiveAudioDevice = function () {
23646
23742
  return _classThis;
23647
23743
  }();
23648
23744
 
23745
+ function runImpl(context, androidImpl, iosImpl) {
23746
+ if (env.getOS() === 'android') {
23747
+ var androidEngine = unpackObject(context);
23748
+ return androidImpl(androidEngine);
23749
+ }
23750
+ else if (env.getOS() === 'ios') {
23751
+ var iosEngine = unpackObject(context);
23752
+ return iosImpl(iosEngine);
23753
+ }
23754
+ else {
23755
+ throw new Error("not support: ".concat(env.getOS()));
23756
+ }
23757
+ }
23758
+ extendsClassMethod(VeLivePusher, 'destroy', function (origin) {
23759
+ return function destory() {
23760
+ var _this = this;
23761
+ origin();
23762
+ return runImpl(this, function (engine) { return __awaiter(_this, void 0, void 0, function () {
23763
+ return __generator(this, function (_a) {
23764
+ VeLivePushHelper$1.removePusher(engine);
23765
+ return [2 /*return*/];
23766
+ });
23767
+ }); }, function (engine) { return __awaiter(_this, void 0, void 0, function () {
23768
+ return __generator(this, function (_a) {
23769
+ VeLivePushHelper.removePusher(engine);
23770
+ return [2 /*return*/];
23771
+ });
23772
+ }); });
23773
+ };
23774
+ });
23649
23775
  extendsClassMethod(VeLivePusher, 'setWatermark', function (superFn) {
23650
23776
  return function setWatermark(image, x, y, scale) {
23651
23777
  return __awaiter(this, void 0, void 0, function () {
@@ -24458,6 +24584,7 @@ function initAndroidPusher(options) {
24458
24584
  _d.sent();
24459
24585
  viewTag = reactNative.findNodeHandle(element);
24460
24586
  reactNative.UIManager.dispatchViewManagerCommand(viewTag, 'resetSurface', []);
24587
+ VeLivePushHelper$1.setPusher(viewId, pusher);
24461
24588
  return [2 /*return*/, packObject(pusher, VeLivePusher)];
24462
24589
  }
24463
24590
  });
@@ -24484,6 +24611,7 @@ function initIOSPusher(options) {
24484
24611
  return [4 /*yield*/, pusher.setRenderView(uiView)];
24485
24612
  case 1:
24486
24613
  _b.sent();
24614
+ VeLivePushHelper.setPusher(viewId, unpackObject(pusher));
24487
24615
  return [2 /*return*/, pusher];
24488
24616
  }
24489
24617
  });
@@ -12692,6 +12692,102 @@ var NativeUIView = function () {
12692
12692
  return UIView;
12693
12693
  })(NativeUIView));
12694
12694
 
12695
+ var VeLivePushHelper$1 = function () {
12696
+ var _classDecorators = [NativeClass('com.volcengine.velive.rn.push.VeLivePushHelper')];
12697
+ var _classDescriptor;
12698
+ var _classExtraInitializers = [];
12699
+ var _classThis;
12700
+ var _staticExtraInitializers = [];
12701
+ var _static_setVeLivePusher_decorators;
12702
+ var _static_removeVeLivePusher_decorators;
12703
+ var VeLivePushHelper = _classThis = /** @class */ (function () {
12704
+ function VeLivePushHelper_1() {
12705
+ }
12706
+ VeLivePushHelper_1.setPusher = function (viewId, pusher) {
12707
+ VeLivePushHelper.pusherMap.set(pusher, viewId);
12708
+ this.setVeLivePusher(viewId, pusher);
12709
+ };
12710
+ VeLivePushHelper_1.removePusher = function (pusher) {
12711
+ var viewId = VeLivePushHelper.pusherMap.get(pusher);
12712
+ if (viewId) {
12713
+ VeLivePushHelper.pusherMap.delete(pusher);
12714
+ this.removeVeLivePusher(viewId);
12715
+ }
12716
+ };
12717
+ VeLivePushHelper_1.setVeLivePusher = function (viewId, pusher) {
12718
+ throw new Error('');
12719
+ };
12720
+ VeLivePushHelper_1.removeVeLivePusher = function (viewId) {
12721
+ throw new Error('');
12722
+ };
12723
+ return VeLivePushHelper_1;
12724
+ }());
12725
+ __setFunctionName(_classThis, "VeLivePushHelper");
12726
+ (function () {
12727
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
12728
+ _static_setVeLivePusher_decorators = [NativeStaticMethodSync()];
12729
+ _static_removeVeLivePusher_decorators = [NativeStaticMethodSync()];
12730
+ __esDecorate(_classThis, null, _static_setVeLivePusher_decorators, { kind: "method", name: "setVeLivePusher", static: true, private: false, access: { has: function (obj) { return "setVeLivePusher" in obj; }, get: function (obj) { return obj.setVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12731
+ __esDecorate(_classThis, null, _static_removeVeLivePusher_decorators, { kind: "method", name: "removeVeLivePusher", static: true, private: false, access: { has: function (obj) { return "removeVeLivePusher" in obj; }, get: function (obj) { return obj.removeVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12732
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
12733
+ VeLivePushHelper = _classThis = _classDescriptor.value;
12734
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
12735
+ })();
12736
+ _classThis.pusherMap = (__runInitializers(_classThis, _staticExtraInitializers), new WeakMap());
12737
+ (function () {
12738
+ __runInitializers(_classThis, _classExtraInitializers);
12739
+ })();
12740
+ return VeLivePushHelper = _classThis;
12741
+ }();
12742
+
12743
+ var VeLivePushHelper = function () {
12744
+ var _classDecorators = [NativeClass('VeLivePushHelper')];
12745
+ var _classDescriptor;
12746
+ var _classExtraInitializers = [];
12747
+ var _classThis;
12748
+ var _staticExtraInitializers = [];
12749
+ var _static_setVeLivePusher_decorators;
12750
+ var _static_removeVeLivePusher_decorators;
12751
+ var VeLivePushHelper = _classThis = /** @class */ (function () {
12752
+ function VeLivePushHelper_1() {
12753
+ }
12754
+ VeLivePushHelper_1.setPusher = function (viewId, pusher) {
12755
+ VeLivePushHelper.pusherMap.set(pusher, viewId);
12756
+ this.setVeLivePusher(pusher, viewId);
12757
+ };
12758
+ VeLivePushHelper_1.removePusher = function (pusher) {
12759
+ var viewId = VeLivePushHelper.pusherMap.get(pusher);
12760
+ if (viewId) {
12761
+ VeLivePushHelper.pusherMap.delete(pusher);
12762
+ this.removeVeLivePusher(viewId);
12763
+ }
12764
+ };
12765
+ VeLivePushHelper_1.setVeLivePusher = function (pusher, viewId) {
12766
+ throw new Error('');
12767
+ };
12768
+ VeLivePushHelper_1.removeVeLivePusher = function (viewId) {
12769
+ throw new Error('');
12770
+ };
12771
+ return VeLivePushHelper_1;
12772
+ }());
12773
+ __setFunctionName(_classThis, "VeLivePushHelper");
12774
+ (function () {
12775
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
12776
+ _static_setVeLivePusher_decorators = [NativeStaticMethodSync('setVeLivePusher:forKey:')];
12777
+ _static_removeVeLivePusher_decorators = [NativeStaticMethodSync('removeVeLivePusher:')];
12778
+ __esDecorate(_classThis, null, _static_setVeLivePusher_decorators, { kind: "method", name: "setVeLivePusher", static: true, private: false, access: { has: function (obj) { return "setVeLivePusher" in obj; }, get: function (obj) { return obj.setVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12779
+ __esDecorate(_classThis, null, _static_removeVeLivePusher_decorators, { kind: "method", name: "removeVeLivePusher", static: true, private: false, access: { has: function (obj) { return "removeVeLivePusher" in obj; }, get: function (obj) { return obj.removeVeLivePusher; } }, metadata: _metadata }, null, _staticExtraInitializers);
12780
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
12781
+ VeLivePushHelper = _classThis = _classDescriptor.value;
12782
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
12783
+ })();
12784
+ _classThis.pusherMap = (__runInitializers(_classThis, _staticExtraInitializers), new WeakMap());
12785
+ (function () {
12786
+ __runInitializers(_classThis, _classExtraInitializers);
12787
+ })();
12788
+ return VeLivePushHelper = _classThis;
12789
+ }();
12790
+
12695
12791
  /** {zh}
12696
12792
  * @detail keytype
12697
12793
  * @brief 推流本地文件录制配置。
@@ -17790,7 +17886,7 @@ var android_VeLivePusherObserver = /** @class */ (function (_super) {
17790
17886
  if (!this._instance['android_onScreenRecording']) {
17791
17887
  return;
17792
17888
  }
17793
- return this._instance['android_onScreenRecording']();
17889
+ return this._instance['android_onScreenRecording'](open);
17794
17890
  };
17795
17891
  android_VeLivePusherObserver.prototype.onNetworkQuality = function (quality) {
17796
17892
  if (!this._instance['onNetworkQuality']) {
@@ -23644,6 +23740,36 @@ var VeLiveAudioDevice = function () {
23644
23740
  return _classThis;
23645
23741
  }();
23646
23742
 
23743
+ function runImpl(context, androidImpl, iosImpl) {
23744
+ if (env.getOS() === 'android') {
23745
+ var androidEngine = unpackObject(context);
23746
+ return androidImpl(androidEngine);
23747
+ }
23748
+ else if (env.getOS() === 'ios') {
23749
+ var iosEngine = unpackObject(context);
23750
+ return iosImpl(iosEngine);
23751
+ }
23752
+ else {
23753
+ throw new Error("not support: ".concat(env.getOS()));
23754
+ }
23755
+ }
23756
+ extendsClassMethod(VeLivePusher, 'destroy', function (origin) {
23757
+ return function destory() {
23758
+ var _this = this;
23759
+ origin();
23760
+ return runImpl(this, function (engine) { return __awaiter(_this, void 0, void 0, function () {
23761
+ return __generator(this, function (_a) {
23762
+ VeLivePushHelper$1.removePusher(engine);
23763
+ return [2 /*return*/];
23764
+ });
23765
+ }); }, function (engine) { return __awaiter(_this, void 0, void 0, function () {
23766
+ return __generator(this, function (_a) {
23767
+ VeLivePushHelper.removePusher(engine);
23768
+ return [2 /*return*/];
23769
+ });
23770
+ }); });
23771
+ };
23772
+ });
23647
23773
  extendsClassMethod(VeLivePusher, 'setWatermark', function (superFn) {
23648
23774
  return function setWatermark(image, x, y, scale) {
23649
23775
  return __awaiter(this, void 0, void 0, function () {
@@ -24456,6 +24582,7 @@ function initAndroidPusher(options) {
24456
24582
  _d.sent();
24457
24583
  viewTag = findNodeHandle(element);
24458
24584
  UIManager.dispatchViewManagerCommand(viewTag, 'resetSurface', []);
24585
+ VeLivePushHelper$1.setPusher(viewId, pusher);
24459
24586
  return [2 /*return*/, packObject(pusher, VeLivePusher)];
24460
24587
  }
24461
24588
  });
@@ -24482,6 +24609,7 @@ function initIOSPusher(options) {
24482
24609
  return [4 /*yield*/, pusher.setRenderView(uiView)];
24483
24610
  case 1:
24484
24611
  _b.sent();
24612
+ VeLivePushHelper.setPusher(viewId, unpackObject(pusher));
24485
24613
  return [2 /*return*/, pusher];
24486
24614
  }
24487
24615
  });
@@ -191,7 +191,7 @@ export interface VeLivePusherObserver {
191
191
  * @order 7
192
192
  *
193
193
  */
194
- android_onScreenRecording?(): void;
194
+ android_onScreenRecording?(open: boolean): void;
195
195
 
196
196
  /** {en}
197
197
  * @detail callback
@@ -0,0 +1,8 @@
1
+ import type { VeLivePusher } from '../../codegen/android';
2
+ export declare class VeLivePushHelper {
3
+ static pusherMap: WeakMap<VeLivePusher, string>;
4
+ static setPusher(viewId: string, pusher: VeLivePusher): void;
5
+ static removePusher(pusher: VeLivePusher): void;
6
+ static setVeLivePusher(viewId: string, pusher: VeLivePusher): void;
7
+ static removeVeLivePusher(viewId: string): void;
8
+ }
@@ -0,0 +1,8 @@
1
+ import type { VeLivePusher } from '../../codegen/ios';
2
+ export declare class VeLivePushHelper {
3
+ static pusherMap: WeakMap<VeLivePusher, string>;
4
+ static setPusher(viewId: string, pusher: VeLivePusher): void;
5
+ static removePusher(pusher: VeLivePusher): void;
6
+ static setVeLivePusher(pusher: VeLivePusher, viewId: string): void;
7
+ static removeVeLivePusher(viewId: string): void;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/react-native-live-push",
3
- "version": "1.1.1",
3
+ "version": "1.1.2-rc.1",
4
4
  "peerDependencies": {
5
5
  "react": "*",
6
6
  "react-native": "*"
@@ -16,27 +16,37 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm}"
18
18
 
19
+ s.static_framework = true
20
+ s.preserve_paths = ['ios/include/react-native-velive-push.modulemap']
21
+
22
+ s.pod_target_xcconfig = {
23
+ 'DEFINES_MODULE' => 'YES',
24
+ 'SWIFT_INCLUDE_PATHS' => '$(PODS_TARGET_SRCROOT)/ios/include',
25
+ 'MODULEMAP_FILE' => '$(PODS_TARGET_SRCROOT)/ios/include/react-native-velive-push.modulemap',
26
+ 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES'
27
+ }
28
+
19
29
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
30
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
31
  if respond_to?(:install_modules_dependencies, true)
22
32
  install_modules_dependencies(s)
23
33
  else
24
- s.dependency "React-Core"
34
+ s.dependency "React-Core"
25
35
 
26
- # Don't install the dependencies when we run `pod install` in the old architecture.
27
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
- s.pod_target_xcconfig = {
30
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
- }
34
- s.dependency "React-Codegen"
35
- s.dependency "RCT-Folly"
36
- s.dependency "RCTRequired"
37
- s.dependency "RCTTypeSafety"
38
- s.dependency "ReactCommon/turbomodule/core"
39
- end
36
+ # Don't install the dependencies when we run `pod install` in the old architecture.
37
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
38
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
39
+ s.pod_target_xcconfig = {
40
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
41
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
42
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
43
+ }
44
+ s.dependency "React-Codegen"
45
+ s.dependency "RCT-Folly"
46
+ s.dependency "RCTRequired"
47
+ s.dependency "RCTTypeSafety"
48
+ s.dependency "ReactCommon/turbomodule/core"
49
+ end
40
50
  end
41
51
 
42
52
  s.dependency 'VolcApiEngine', '1.2.3'