@byteplus/react-native-live-push 1.1.1-rc.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/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushView.java +11 -5
- package/ios/VeLivePushHelper.h +28 -0
- package/ios/VeLivePushHelper.m +62 -0
- package/lib/commonjs/index.js +80 -2803
- package/lib/module/index.js +80 -2803
- 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);
|
|
@@ -31,7 +31,6 @@ public class VeLivePushView extends FrameLayout {
|
|
|
31
31
|
public void setViewId(String viewId) {
|
|
32
32
|
this.viewId = viewId;
|
|
33
33
|
this.hasRegister = true;
|
|
34
|
-
this.emitOnLoad();
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
public void setViewKind(String viewKind) {
|
|
@@ -43,10 +42,10 @@ public class VeLivePushView extends FrameLayout {
|
|
|
43
42
|
surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
|
44
43
|
@Override
|
|
45
44
|
public void surfaceCreated(@NonNull SurfaceHolder holder) {
|
|
46
|
-
hasLoad = true;
|
|
47
45
|
subview = surfaceView;
|
|
48
46
|
VolcViewManager.putViewById(viewId, subview);
|
|
49
47
|
emitOnLoad();
|
|
48
|
+
hasLoad = true;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
@Override
|
|
@@ -67,9 +66,9 @@ public class VeLivePushView extends FrameLayout {
|
|
|
67
66
|
@Override
|
|
68
67
|
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture,
|
|
69
68
|
int width, int height) {
|
|
70
|
-
hasLoad = true;
|
|
71
69
|
VolcViewManager.putViewById(viewId, subview);
|
|
72
70
|
emitOnLoad();
|
|
71
|
+
hasLoad = true;
|
|
73
72
|
}
|
|
74
73
|
@Override
|
|
75
74
|
public void onSurfaceTextureSizeChanged(
|
|
@@ -93,8 +92,15 @@ public class VeLivePushView extends FrameLayout {
|
|
|
93
92
|
public void resetSurface() {
|
|
94
93
|
if (subview instanceof SurfaceView) {
|
|
95
94
|
SurfaceView surface = (SurfaceView)subview;
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
post(new Runnable() {
|
|
96
|
+
@Override
|
|
97
|
+
public void run() {
|
|
98
|
+
removeView(surface);
|
|
99
|
+
addView(surface);
|
|
100
|
+
surface.requestLayout();
|
|
101
|
+
surface.invalidate();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
|
|
@@ -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
|
+
|