@byteplus/react-native-live-push 1.1.1 → 1.1.2-rc.0
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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushHelper.java +22 -0
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushModule.java +5 -0
- package/ios/VeLivePushHelper.h +28 -0
- package/ios/VeLivePushHelper.m +62 -0
- package/lib/commonjs/index.js +79 -1
- package/lib/module/index.js +79 -1
- package/lib/typescript/codegen/pack/callback.d.ts +1 -1
- package/lib/typescript/platforms/android/helper.d.ts +8 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -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
|
-
|
|
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,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VeLivePushHelper.h
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by ByteDance on 2025/5/7.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "TTSDKFramework/VeLivePusher.h"
|
|
10
|
+
|
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
+
|
|
13
|
+
@interface VeLivePushHelper : NSObject
|
|
14
|
+
|
|
15
|
+
+ (instancetype)sharedInstance;
|
|
16
|
+
|
|
17
|
+
- (nullable VeLivePusher *)getVeLivePusherWithKey:(NSString *)key;
|
|
18
|
+
|
|
19
|
+
- (void)setVeLivePusher:(VeLivePusher *)pusher forKey:(NSString *)key;
|
|
20
|
+
|
|
21
|
+
- (void)removeVeLivePusher:(NSString *)key;
|
|
22
|
+
|
|
23
|
+
- (void)removeAllVeLivePushers;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
NS_ASSUME_NONNULL_END
|
|
28
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// VeLivePushHelper.m
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by ByteDance on 2025/5/7.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "VeLivePushHelper.h"
|
|
9
|
+
#import "TTSDKFramework/VeLivePusher.h"
|
|
10
|
+
|
|
11
|
+
@interface VeLivePushHelper ()
|
|
12
|
+
|
|
13
|
+
@property (nonatomic, strong) NSMapTable<NSString *, VeLivePusher *> *pusherMap;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@implementation VeLivePushHelper
|
|
18
|
+
|
|
19
|
+
+ (instancetype)sharedInstance {
|
|
20
|
+
static VeLivePushHelper *instance = nil;
|
|
21
|
+
static dispatch_once_t onceToken;
|
|
22
|
+
dispatch_once(&onceToken, ^{
|
|
23
|
+
instance = [[self alloc] init];
|
|
24
|
+
});
|
|
25
|
+
return instance;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (instancetype)init {
|
|
29
|
+
self = [super init];
|
|
30
|
+
if (self) {
|
|
31
|
+
_pusherMap = [NSMapTable strongToWeakObjectsMapTable];
|
|
32
|
+
}
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (nullable VeLivePusher *)getVeLivePusherWithKey:(NSString *)key {
|
|
37
|
+
if (!key) {
|
|
38
|
+
return nil;
|
|
39
|
+
}
|
|
40
|
+
return [self.pusherMap objectForKey:key];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (void)setVeLivePusher:(VeLivePusher *)pusher forKey:(NSString *)key {
|
|
44
|
+
if (!key || !pusher) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
[self.pusherMap setObject:pusher forKey:key];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)removeVeLivePusher:(NSString *)key {
|
|
51
|
+
if (!key) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
[self.pusherMap removeObjectForKey:key];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)removeAllVeLivePushers {
|
|
58
|
+
[self.pusherMap removeAllObjects];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@end
|
|
62
|
+
|
package/lib/commonjs/index.js
CHANGED
|
@@ -12694,6 +12694,54 @@ var NativeUIView = function () {
|
|
|
12694
12694
|
return UIView;
|
|
12695
12695
|
})(NativeUIView));
|
|
12696
12696
|
|
|
12697
|
+
var VeLivePushHelper = 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
|
+
|
|
12697
12745
|
/** {zh}
|
|
12698
12746
|
* @detail keytype
|
|
12699
12747
|
* @brief 推流本地文件录制配置。
|
|
@@ -17792,7 +17840,7 @@ var android_VeLivePusherObserver = /** @class */ (function (_super) {
|
|
|
17792
17840
|
if (!this._instance['android_onScreenRecording']) {
|
|
17793
17841
|
return;
|
|
17794
17842
|
}
|
|
17795
|
-
return this._instance['android_onScreenRecording']();
|
|
17843
|
+
return this._instance['android_onScreenRecording'](open);
|
|
17796
17844
|
};
|
|
17797
17845
|
android_VeLivePusherObserver.prototype.onNetworkQuality = function (quality) {
|
|
17798
17846
|
if (!this._instance['onNetworkQuality']) {
|
|
@@ -23646,6 +23694,35 @@ var VeLiveAudioDevice = function () {
|
|
|
23646
23694
|
return _classThis;
|
|
23647
23695
|
}();
|
|
23648
23696
|
|
|
23697
|
+
function runImpl(context, androidImpl, iosImpl) {
|
|
23698
|
+
if (env.getOS() === 'android') {
|
|
23699
|
+
var androidEngine = unpackObject(context);
|
|
23700
|
+
return androidImpl(androidEngine);
|
|
23701
|
+
}
|
|
23702
|
+
else if (env.getOS() === 'ios') {
|
|
23703
|
+
var iosEngine = unpackObject(context);
|
|
23704
|
+
return iosImpl(iosEngine);
|
|
23705
|
+
}
|
|
23706
|
+
else {
|
|
23707
|
+
throw new Error("not support: ".concat(env.getOS()));
|
|
23708
|
+
}
|
|
23709
|
+
}
|
|
23710
|
+
extendsClassMethod(VeLivePusher, 'destroy', function (origin) {
|
|
23711
|
+
return function destory() {
|
|
23712
|
+
var _this = this;
|
|
23713
|
+
origin();
|
|
23714
|
+
return runImpl(this, function (engine) { return __awaiter(_this, void 0, void 0, function () {
|
|
23715
|
+
return __generator(this, function (_a) {
|
|
23716
|
+
VeLivePushHelper.removePusher(engine);
|
|
23717
|
+
return [2 /*return*/];
|
|
23718
|
+
});
|
|
23719
|
+
}); }, function (engine) { return __awaiter(_this, void 0, void 0, function () {
|
|
23720
|
+
return __generator(this, function (_a) {
|
|
23721
|
+
return [2 /*return*/];
|
|
23722
|
+
});
|
|
23723
|
+
}); });
|
|
23724
|
+
};
|
|
23725
|
+
});
|
|
23649
23726
|
extendsClassMethod(VeLivePusher, 'setWatermark', function (superFn) {
|
|
23650
23727
|
return function setWatermark(image, x, y, scale) {
|
|
23651
23728
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -24458,6 +24535,7 @@ function initAndroidPusher(options) {
|
|
|
24458
24535
|
_d.sent();
|
|
24459
24536
|
viewTag = reactNative.findNodeHandle(element);
|
|
24460
24537
|
reactNative.UIManager.dispatchViewManagerCommand(viewTag, 'resetSurface', []);
|
|
24538
|
+
VeLivePushHelper.setPusher(viewId, pusher);
|
|
24461
24539
|
return [2 /*return*/, packObject(pusher, VeLivePusher)];
|
|
24462
24540
|
}
|
|
24463
24541
|
});
|
package/lib/module/index.js
CHANGED
|
@@ -12692,6 +12692,54 @@ var NativeUIView = function () {
|
|
|
12692
12692
|
return UIView;
|
|
12693
12693
|
})(NativeUIView));
|
|
12694
12694
|
|
|
12695
|
+
var VeLivePushHelper = 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
|
+
|
|
12695
12743
|
/** {zh}
|
|
12696
12744
|
* @detail keytype
|
|
12697
12745
|
* @brief 推流本地文件录制配置。
|
|
@@ -17790,7 +17838,7 @@ var android_VeLivePusherObserver = /** @class */ (function (_super) {
|
|
|
17790
17838
|
if (!this._instance['android_onScreenRecording']) {
|
|
17791
17839
|
return;
|
|
17792
17840
|
}
|
|
17793
|
-
return this._instance['android_onScreenRecording']();
|
|
17841
|
+
return this._instance['android_onScreenRecording'](open);
|
|
17794
17842
|
};
|
|
17795
17843
|
android_VeLivePusherObserver.prototype.onNetworkQuality = function (quality) {
|
|
17796
17844
|
if (!this._instance['onNetworkQuality']) {
|
|
@@ -23644,6 +23692,35 @@ var VeLiveAudioDevice = function () {
|
|
|
23644
23692
|
return _classThis;
|
|
23645
23693
|
}();
|
|
23646
23694
|
|
|
23695
|
+
function runImpl(context, androidImpl, iosImpl) {
|
|
23696
|
+
if (env.getOS() === 'android') {
|
|
23697
|
+
var androidEngine = unpackObject(context);
|
|
23698
|
+
return androidImpl(androidEngine);
|
|
23699
|
+
}
|
|
23700
|
+
else if (env.getOS() === 'ios') {
|
|
23701
|
+
var iosEngine = unpackObject(context);
|
|
23702
|
+
return iosImpl(iosEngine);
|
|
23703
|
+
}
|
|
23704
|
+
else {
|
|
23705
|
+
throw new Error("not support: ".concat(env.getOS()));
|
|
23706
|
+
}
|
|
23707
|
+
}
|
|
23708
|
+
extendsClassMethod(VeLivePusher, 'destroy', function (origin) {
|
|
23709
|
+
return function destory() {
|
|
23710
|
+
var _this = this;
|
|
23711
|
+
origin();
|
|
23712
|
+
return runImpl(this, function (engine) { return __awaiter(_this, void 0, void 0, function () {
|
|
23713
|
+
return __generator(this, function (_a) {
|
|
23714
|
+
VeLivePushHelper.removePusher(engine);
|
|
23715
|
+
return [2 /*return*/];
|
|
23716
|
+
});
|
|
23717
|
+
}); }, function (engine) { return __awaiter(_this, void 0, void 0, function () {
|
|
23718
|
+
return __generator(this, function (_a) {
|
|
23719
|
+
return [2 /*return*/];
|
|
23720
|
+
});
|
|
23721
|
+
}); });
|
|
23722
|
+
};
|
|
23723
|
+
});
|
|
23647
23724
|
extendsClassMethod(VeLivePusher, 'setWatermark', function (superFn) {
|
|
23648
23725
|
return function setWatermark(image, x, y, scale) {
|
|
23649
23726
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -24456,6 +24533,7 @@ function initAndroidPusher(options) {
|
|
|
24456
24533
|
_d.sent();
|
|
24457
24534
|
viewTag = findNodeHandle(element);
|
|
24458
24535
|
UIManager.dispatchViewManagerCommand(viewTag, 'resetSurface', []);
|
|
24536
|
+
VeLivePushHelper.setPusher(viewId, pusher);
|
|
24459
24537
|
return [2 /*return*/, packObject(pusher, VeLivePusher)];
|
|
24460
24538
|
}
|
|
24461
24539
|
});
|
|
@@ -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
|
+
}
|