@byteplus/react-native-live-push 1.1.3-rc.3 → 1.1.4-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/src/main/java/com/volcengine/velive/rn/push/VeLivePushModule.java +2 -13
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushPackage.java +13 -16
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushView.java +0 -16
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushViewManager.java +2 -7
- package/lib/commonjs/index.js +2126 -2925
- package/lib/module/index.js +2128 -2922
- package/lib/typescript/codegen/android/api.d.ts +121 -1
- package/lib/typescript/codegen/ios/api.d.ts +28 -1
- package/lib/typescript/codegen/pack/api.d.ts +133 -1
- package/lib/typescript/core/api.d.ts +2 -17
- package/lib/typescript/core/keytype.d.ts +0 -15
- package/lib/typescript/index.d.ts +0 -1
- package/package.json +1 -1
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/MixerManager.java +0 -397
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/MixerView.java +0 -423
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/MixerViewManager.java +0 -79
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/TextureMgr.java +0 -168
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/YuvHelper.java +0 -165
- package/ios/VeLiveMixerHelper.h +0 -44
- package/ios/VeLiveMixerHelper.m +0 -591
- package/ios/VeLiveMixerView.h +0 -69
- package/ios/VeLiveMixerView.m +0 -592
- package/ios/VeLiveMixerViewManager.m +0 -92
- package/lib/commonjs/typescript/android/index.d.ts +0 -47
- package/lib/commonjs/typescript/codegen/android/api.d.ts +0 -1527
- package/lib/commonjs/typescript/codegen/android/callback.d.ts +0 -91
- package/lib/commonjs/typescript/codegen/android/errorcode.d.ts +0 -26
- package/lib/commonjs/typescript/codegen/android/index.d.ts +0 -5
- package/lib/commonjs/typescript/codegen/android/keytype.d.ts +0 -846
- package/lib/commonjs/typescript/codegen/android/types.d.ts +0 -33
- package/lib/commonjs/typescript/codegen/ios/api.d.ts +0 -222
- package/lib/commonjs/typescript/codegen/ios/callback.d.ts +0 -80
- package/lib/commonjs/typescript/codegen/ios/errorcode.d.ts +0 -54
- package/lib/commonjs/typescript/codegen/ios/external.d.ts +0 -1
- package/lib/commonjs/typescript/codegen/ios/index.d.ts +0 -6
- package/lib/commonjs/typescript/codegen/ios/keytype.d.ts +0 -460
- package/lib/commonjs/typescript/codegen/ios/types.d.ts +0 -46
- package/lib/commonjs/typescript/codegen/pack/api.d.ts +0 -1835
- package/lib/commonjs/typescript/codegen/pack/callback.d.ts +0 -400
- package/lib/commonjs/typescript/codegen/pack/errorcode.d.ts +0 -35
- package/lib/commonjs/typescript/codegen/pack/index.d.ts +0 -5
- package/lib/commonjs/typescript/codegen/pack/keytype.d.ts +0 -1392
- package/lib/commonjs/typescript/codegen/pack/types.d.ts +0 -68
- package/lib/commonjs/typescript/codegen/type-shim.d.ts +0 -6
- package/lib/commonjs/typescript/component.d.ts +0 -15
- package/lib/commonjs/typescript/core/api.d.ts +0 -17
- package/lib/commonjs/typescript/core/callback.d.ts +0 -2
- package/lib/commonjs/typescript/core/env.d.ts +0 -29
- package/lib/commonjs/typescript/core/errorcode.d.ts +0 -2
- package/lib/commonjs/typescript/core/index.d.ts +0 -6
- package/lib/commonjs/typescript/core/keytype.d.ts +0 -17
- package/lib/commonjs/typescript/core/mixer.d.ts +0 -26
- package/lib/commonjs/typescript/core/pusher.d.ts +0 -16
- package/lib/commonjs/typescript/index.d.ts +0 -3
- package/lib/commonjs/typescript/ios/extends.d.ts +0 -41
- package/lib/commonjs/typescript/platforms/android/extends.d.ts +0 -8
- package/lib/commonjs/typescript/platforms/android/helper.d.ts +0 -8
- package/lib/commonjs/typescript/platforms/android/mixer.d.ts +0 -8
- package/lib/commonjs/typescript/platforms/ios/extends.d.ts +0 -17
- package/lib/commonjs/typescript/platforms/ios/helper.d.ts +0 -8
- package/lib/commonjs/typescript/platforms/ios/mixer.d.ts +0 -9
- package/lib/commonjs/typescript/runtime.d.ts +0 -1
- package/lib/commonjs/typescript/view/MixView.d.ts +0 -52
- package/lib/commonjs/typescript/view/VeImageView.d.ts +0 -19
- package/lib/commonjs/typescript/view/VeTextView.d.ts +0 -7
- package/lib/commonjs/typescript/view/VeView.d.ts +0 -7
- package/lib/commonjs/typescript/view/VeWebView.d.ts +0 -7
- package/lib/commonjs/typescript/view/index.d.ts +0 -5
- package/lib/module/typescript/android/index.d.ts +0 -47
- package/lib/module/typescript/codegen/android/api.d.ts +0 -1527
- package/lib/module/typescript/codegen/android/callback.d.ts +0 -91
- package/lib/module/typescript/codegen/android/errorcode.d.ts +0 -26
- package/lib/module/typescript/codegen/android/index.d.ts +0 -5
- package/lib/module/typescript/codegen/android/keytype.d.ts +0 -846
- package/lib/module/typescript/codegen/android/types.d.ts +0 -33
- package/lib/module/typescript/codegen/ios/api.d.ts +0 -222
- package/lib/module/typescript/codegen/ios/callback.d.ts +0 -80
- package/lib/module/typescript/codegen/ios/errorcode.d.ts +0 -54
- package/lib/module/typescript/codegen/ios/external.d.ts +0 -1
- package/lib/module/typescript/codegen/ios/index.d.ts +0 -6
- package/lib/module/typescript/codegen/ios/keytype.d.ts +0 -460
- package/lib/module/typescript/codegen/ios/types.d.ts +0 -46
- package/lib/module/typescript/codegen/pack/api.d.ts +0 -1835
- package/lib/module/typescript/codegen/pack/callback.d.ts +0 -400
- package/lib/module/typescript/codegen/pack/errorcode.d.ts +0 -35
- package/lib/module/typescript/codegen/pack/index.d.ts +0 -5
- package/lib/module/typescript/codegen/pack/keytype.d.ts +0 -1392
- package/lib/module/typescript/codegen/pack/types.d.ts +0 -68
- package/lib/module/typescript/codegen/type-shim.d.ts +0 -6
- package/lib/module/typescript/component.d.ts +0 -15
- package/lib/module/typescript/core/api.d.ts +0 -17
- package/lib/module/typescript/core/callback.d.ts +0 -2
- package/lib/module/typescript/core/env.d.ts +0 -29
- package/lib/module/typescript/core/errorcode.d.ts +0 -2
- package/lib/module/typescript/core/index.d.ts +0 -6
- package/lib/module/typescript/core/keytype.d.ts +0 -17
- package/lib/module/typescript/core/mixer.d.ts +0 -26
- package/lib/module/typescript/core/pusher.d.ts +0 -16
- package/lib/module/typescript/index.d.ts +0 -3
- package/lib/module/typescript/ios/extends.d.ts +0 -41
- package/lib/module/typescript/platforms/android/extends.d.ts +0 -8
- package/lib/module/typescript/platforms/android/helper.d.ts +0 -8
- package/lib/module/typescript/platforms/android/mixer.d.ts +0 -8
- package/lib/module/typescript/platforms/ios/extends.d.ts +0 -17
- package/lib/module/typescript/platforms/ios/helper.d.ts +0 -8
- package/lib/module/typescript/platforms/ios/mixer.d.ts +0 -9
- package/lib/module/typescript/runtime.d.ts +0 -1
- package/lib/module/typescript/view/MixView.d.ts +0 -52
- package/lib/module/typescript/view/VeImageView.d.ts +0 -19
- package/lib/module/typescript/view/VeTextView.d.ts +0 -7
- package/lib/module/typescript/view/VeView.d.ts +0 -7
- package/lib/module/typescript/view/VeWebView.d.ts +0 -7
- package/lib/module/typescript/view/index.d.ts +0 -5
- package/lib/typescript/core/mixer.d.ts +0 -26
- package/lib/typescript/platforms/android/extends.d.ts +0 -8
- package/lib/typescript/platforms/android/mixer.d.ts +0 -8
- package/lib/typescript/platforms/ios/mixer.d.ts +0 -9
- package/lib/typescript/view/MixView.d.ts +0 -52
- package/lib/typescript/view/VeImageView.d.ts +0 -19
- package/lib/typescript/view/VeTextView.d.ts +0 -7
- package/lib/typescript/view/VeView.d.ts +0 -7
- package/lib/typescript/view/VeWebView.d.ts +0 -7
- package/lib/typescript/view/index.d.ts +0 -5
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
package com.volcengine.velive.rn.push.mixer;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.graphics.Bitmap;
|
|
5
|
-
import android.graphics.Matrix;
|
|
6
|
-
import android.renderscript.Allocation;
|
|
7
|
-
import android.renderscript.Element;
|
|
8
|
-
import android.renderscript.RenderScript;
|
|
9
|
-
import android.renderscript.ScriptIntrinsicYuvToRGB;
|
|
10
|
-
import android.renderscript.Type;
|
|
11
|
-
|
|
12
|
-
import java.nio.ByteBuffer;
|
|
13
|
-
|
|
14
|
-
public class YuvHelper {
|
|
15
|
-
private static RenderScript globalRS = null;
|
|
16
|
-
public static synchronized RenderScript getGlobalRS(Context context) {
|
|
17
|
-
if (globalRS == null) {
|
|
18
|
-
globalRS = RenderScript.create(context.getApplicationContext());
|
|
19
|
-
}
|
|
20
|
-
return globalRS;
|
|
21
|
-
}
|
|
22
|
-
public static void destroyGlobalRS() {
|
|
23
|
-
if (globalRS != null) {
|
|
24
|
-
globalRS.destroy();
|
|
25
|
-
globalRS = null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
public static class NV21ToBitmap {
|
|
29
|
-
private RenderScript rs;
|
|
30
|
-
private ScriptIntrinsicYuvToRGB yuvToRgbIntrinsic;
|
|
31
|
-
private Type.Builder yuvType, rgbaType;
|
|
32
|
-
|
|
33
|
-
public NV21ToBitmap(Context context) {
|
|
34
|
-
rs = YuvHelper.getGlobalRS(context);
|
|
35
|
-
yuvToRgbIntrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs));
|
|
36
|
-
yuvType = new Type.Builder(rs, Element.U8(rs));
|
|
37
|
-
rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public void cleanup() {
|
|
41
|
-
try {
|
|
42
|
-
if (yuvToRgbIntrinsic != null) {
|
|
43
|
-
yuvToRgbIntrinsic.destroy();
|
|
44
|
-
yuvToRgbIntrinsic = null;
|
|
45
|
-
}
|
|
46
|
-
// 不销毁全局 rs
|
|
47
|
-
// rs = null;
|
|
48
|
-
} catch (Exception e) {
|
|
49
|
-
// Ignore
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public Bitmap nv21ToBitmap(byte[] nv21, int width, int height) {
|
|
54
|
-
Allocation in = null;
|
|
55
|
-
Allocation out = null;
|
|
56
|
-
try {
|
|
57
|
-
yuvType.setX(nv21.length);
|
|
58
|
-
in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);
|
|
59
|
-
in.copyFrom(nv21);
|
|
60
|
-
|
|
61
|
-
rgbaType.setX(width).setY(height);
|
|
62
|
-
out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);
|
|
63
|
-
yuvToRgbIntrinsic.setInput(in);
|
|
64
|
-
yuvToRgbIntrinsic.forEach(out);
|
|
65
|
-
|
|
66
|
-
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
|
67
|
-
out.copyTo(bmp);
|
|
68
|
-
|
|
69
|
-
return bmp;
|
|
70
|
-
} finally {
|
|
71
|
-
if (in != null) {
|
|
72
|
-
in.destroy();
|
|
73
|
-
}
|
|
74
|
-
if (out != null) {
|
|
75
|
-
out.destroy();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public static void NV21toI420(ByteBuffer input, ByteBuffer output, final int width, final int height) {
|
|
82
|
-
final int size = width * height;
|
|
83
|
-
final int quarter = size / 4;
|
|
84
|
-
final int v0 = size + quarter;
|
|
85
|
-
|
|
86
|
-
System.arraycopy(input.array(), 0, output.array(), 0, size);
|
|
87
|
-
|
|
88
|
-
for (int u = size, v = v0, o = size; u < v0; u++, v++, o += 2) {
|
|
89
|
-
output.array()[v] = input.array()[o];
|
|
90
|
-
output.array()[u] = input.array()[o + 1];
|
|
91
|
-
}
|
|
92
|
-
output.limit(width * height * 3 / 2);
|
|
93
|
-
output.position(0);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public static void NV21toNV12(ByteBuffer input, ByteBuffer output, final int width, final int height) {
|
|
97
|
-
final int size = width * height;
|
|
98
|
-
|
|
99
|
-
System.arraycopy(input.array(), 0, output.array(), 0, size);
|
|
100
|
-
for (int i = size; i < 1.5f * size; i += 2) {
|
|
101
|
-
output.array()[i] = input.array()[i + 1];
|
|
102
|
-
output.array()[i + 1] = input.array()[i];
|
|
103
|
-
}
|
|
104
|
-
output.position(0);
|
|
105
|
-
output.limit(width * height * 3 / 2);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public static void NV12toI420(ByteBuffer input, ByteBuffer output, final int width, final int height) {
|
|
109
|
-
final int size = width * height;
|
|
110
|
-
final int quarter = size / 4;
|
|
111
|
-
final int v0 = size + quarter;
|
|
112
|
-
|
|
113
|
-
System.arraycopy(input.array(), 0, output.array(), 0, size);
|
|
114
|
-
|
|
115
|
-
for (int u = size, v = v0, o = size; u < v0; u++, v++, o += 2) {
|
|
116
|
-
output.array()[v] = input.array()[o + 1];
|
|
117
|
-
output.array()[u] = input.array()[o];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public static void I420toNV21(ByteBuffer input, ByteBuffer output, final int width, final int height) {
|
|
122
|
-
final int size = width * height;
|
|
123
|
-
final int quarter = size / 4;
|
|
124
|
-
final int v0 = size + quarter;
|
|
125
|
-
|
|
126
|
-
System.arraycopy(input.array(), 0, output.array(), 0, size);
|
|
127
|
-
|
|
128
|
-
for (int u = size, v = v0, o = size; u < v0; u++, v++, o += 2) {
|
|
129
|
-
output.array()[o + 1] = input.array()[v];
|
|
130
|
-
output.array()[o] = input.array()[u];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public static Bitmap rotateBitmap(Bitmap origin, float alpha, boolean horizontalMirror, boolean verticalMirror) {
|
|
135
|
-
if (origin == null || origin.isRecycled()) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
int width = origin.getWidth();
|
|
141
|
-
int height = origin.getHeight();
|
|
142
|
-
Matrix matrix = new Matrix();
|
|
143
|
-
float sx = 1;
|
|
144
|
-
float sy = 1;
|
|
145
|
-
if (horizontalMirror) {
|
|
146
|
-
sx = -1;
|
|
147
|
-
}
|
|
148
|
-
if (verticalMirror) {
|
|
149
|
-
sy = -1;
|
|
150
|
-
}
|
|
151
|
-
matrix.postScale(sx, sy);
|
|
152
|
-
matrix.postRotate(alpha);
|
|
153
|
-
|
|
154
|
-
if (origin.isRecycled()) {
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return Bitmap.createBitmap(origin, 0, 0, width, height, matrix, false);
|
|
159
|
-
} catch (IllegalStateException e) {
|
|
160
|
-
return null;
|
|
161
|
-
} catch (Exception e) {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
package/ios/VeLiveMixerHelper.h
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// VeLiveMixerHelper.h
|
|
3
|
-
// react-native-live-push
|
|
4
|
-
//
|
|
5
|
-
// Created by ByteDance on 2024/12/09.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
|
-
#import "VeLiveMixerView.h"
|
|
10
|
-
|
|
11
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
12
|
-
|
|
13
|
-
// 前向声明
|
|
14
|
-
@class VeLivePusher;
|
|
15
|
-
|
|
16
|
-
// 混流管理器助手类 - 完全对齐Android MixerManager.java
|
|
17
|
-
@interface VeLiveMixerHelper : NSObject <VeLiveBitmapCaptureCallback>
|
|
18
|
-
|
|
19
|
-
// 对齐Android的static cachedMixedViews
|
|
20
|
-
@property (class, nonatomic, strong) NSMutableDictionary<NSString *, VeLiveMixerUIView *> *cachedMixedViews;
|
|
21
|
-
|
|
22
|
-
@property (nonatomic, weak) VeLivePusher *pusher;
|
|
23
|
-
|
|
24
|
-
- (instancetype)initWithPusher:(VeLivePusher *)pusher;
|
|
25
|
-
|
|
26
|
-
// Public方法 - 完全对齐Android MixerManager的public接口
|
|
27
|
-
- (void)setPusher:(VeLivePusher *)pusher;
|
|
28
|
-
- (int)addView:(NSString *)viewId config:(NSDictionary *)viewInfo;
|
|
29
|
-
- (BOOL)updateView:(NSString *)viewId config:(NSDictionary *)viewInfo;
|
|
30
|
-
- (BOOL)removeView:(NSString *)viewId;
|
|
31
|
-
- (void)captureView:(NSString *)viewId;
|
|
32
|
-
|
|
33
|
-
// Static方法 - 只保留Android中实际存在的
|
|
34
|
-
+ (void)setupCallbackForMixerView:(VeLiveMixerUIView *)mixerView streamId:(int)streamId;
|
|
35
|
-
+ (void)sendBitmapToMixerStatic:(int)streamId bitmap:(UIImage *)bitmap;
|
|
36
|
-
+ (VeLiveMixerHelper *)findActiveMixerManager;
|
|
37
|
-
+ (void)onViewReady:(NSString *)viewId mixerView:(VeLiveMixerUIView *)mixerView;
|
|
38
|
-
|
|
39
|
-
// 清理资源
|
|
40
|
-
- (void)cleanup;
|
|
41
|
-
|
|
42
|
-
@end
|
|
43
|
-
|
|
44
|
-
NS_ASSUME_NONNULL_END
|