@byteplus/react-native-live-push 1.1.3-rc.4 → 1.2.0-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 +2 -2
- package/android/src/main/java/com/volcengine/velive/rn/push/ClassHelper.java +9 -0
- package/android/src/main/java/com/volcengine/velive/rn/push/NativeVariableManager.java +5 -8
- package/android/src/main/java/com/volcengine/velive/rn/push/VeLivePushModule.java +1 -0
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/MixerManager.java +1 -3
- package/android/src/main/java/com/volcengine/velive/rn/push/mixer/MixerView.java +33 -22
- package/ios/VeLiveMixerHelper.h +7 -5
- package/ios/VeLiveMixerHelper.m +1 -1
- package/ios/VeLiveMixerViewManager.m +2 -2
- package/lib/commonjs/index.js +23202 -20302
- package/lib/commonjs/typescript/android/index.d.ts +0 -3
- package/lib/commonjs/typescript/codegen/android/api.d.ts +190 -644
- package/lib/commonjs/typescript/codegen/android/callback.d.ts +234 -2
- package/lib/commonjs/typescript/codegen/android/errorcode.d.ts +66 -0
- package/lib/commonjs/typescript/codegen/android/keytype.d.ts +1014 -181
- package/lib/commonjs/typescript/codegen/ios/api.d.ts +890 -0
- package/lib/commonjs/typescript/codegen/ios/callback.d.ts +162 -0
- package/lib/commonjs/typescript/codegen/ios/errorcode.d.ts +101 -1
- package/lib/commonjs/typescript/codegen/ios/keytype.d.ts +694 -0
- package/lib/commonjs/typescript/codegen/pack/api.d.ts +303 -686
- package/lib/commonjs/typescript/codegen/pack/callback.d.ts +37 -38
- package/lib/commonjs/typescript/codegen/pack/errorcode.d.ts +75 -5
- package/lib/commonjs/typescript/codegen/pack/keytype.d.ts +1002 -298
- package/lib/commonjs/typescript/core/api.d.ts +2 -1
- package/lib/commonjs/typescript/core/pusher.d.ts +0 -3
- package/lib/module/index.js +23203 -20302
- package/lib/module/typescript/android/index.d.ts +0 -3
- package/lib/module/typescript/codegen/android/api.d.ts +190 -644
- package/lib/module/typescript/codegen/android/callback.d.ts +234 -2
- package/lib/module/typescript/codegen/android/errorcode.d.ts +66 -0
- package/lib/module/typescript/codegen/android/keytype.d.ts +1014 -181
- package/lib/module/typescript/codegen/ios/api.d.ts +890 -0
- package/lib/module/typescript/codegen/ios/callback.d.ts +162 -0
- package/lib/module/typescript/codegen/ios/errorcode.d.ts +101 -1
- package/lib/module/typescript/codegen/ios/keytype.d.ts +694 -0
- package/lib/module/typescript/codegen/pack/api.d.ts +303 -686
- package/lib/module/typescript/codegen/pack/callback.d.ts +37 -38
- package/lib/module/typescript/codegen/pack/errorcode.d.ts +75 -5
- package/lib/module/typescript/codegen/pack/keytype.d.ts +1002 -298
- package/lib/module/typescript/core/api.d.ts +2 -1
- package/lib/module/typescript/core/pusher.d.ts +0 -3
- package/lib/typescript/android/index.d.ts +0 -3
- package/lib/typescript/codegen/android/api.d.ts +190 -644
- package/lib/typescript/codegen/android/callback.d.ts +234 -2
- package/lib/typescript/codegen/android/errorcode.d.ts +66 -0
- package/lib/typescript/codegen/android/keytype.d.ts +1014 -181
- package/lib/typescript/codegen/ios/api.d.ts +890 -0
- package/lib/typescript/codegen/ios/callback.d.ts +162 -0
- package/lib/typescript/codegen/ios/errorcode.d.ts +101 -1
- package/lib/typescript/codegen/ios/keytype.d.ts +694 -0
- package/lib/typescript/codegen/pack/api.d.ts +303 -686
- package/lib/typescript/codegen/pack/callback.d.ts +37 -38
- package/lib/typescript/codegen/pack/errorcode.d.ts +75 -5
- package/lib/typescript/codegen/pack/keytype.d.ts +1002 -298
- package/lib/typescript/core/api.d.ts +2 -1
- package/lib/typescript/core/pusher.d.ts +0 -3
- package/package.json +1 -1
- package/react-native-velive-push.podspec +3 -3
- package/android/src/main/java/com/volcengine/velive/rn/push/ScreenCaptureHelper.java +0 -73
package/android/build.gradle
CHANGED
|
@@ -87,6 +87,6 @@ dependencies {
|
|
|
87
87
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
88
88
|
//noinspection GradleDynamicVersion
|
|
89
89
|
implementation "com.facebook.react:react-native:+"
|
|
90
|
-
implementation "com.volcengine:VolcApiEngine:1.2
|
|
91
|
-
api 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.
|
|
90
|
+
implementation "com.volcengine:VolcApiEngine:1.6.2"
|
|
91
|
+
api 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.46.300.2'
|
|
92
92
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package com.volcengine.velive.rn.push;
|
|
2
|
+
import com.ss.avframework.live.statistics.VeLivePusherStatisticsExt;
|
|
3
|
+
import com.volcengine.VolcApiEngine.runtime.Util;
|
|
4
|
+
|
|
5
|
+
public class ClassHelper {
|
|
6
|
+
public static void init() {
|
|
7
|
+
Util.JsonAbleClass.add(VeLivePusherStatisticsExt.class);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
package com.volcengine.velive.rn.push;
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
4
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
5
|
import com.volcengine.VolcApiEngine.*;
|
|
7
6
|
|
|
8
7
|
public class NativeVariableManager {
|
|
9
|
-
static void init(@NonNull VolcApiEngine apiEngine,
|
|
8
|
+
static void init(@NonNull VolcApiEngine apiEngine,
|
|
9
|
+
ReactApplicationContext reactContext) {
|
|
10
10
|
var m = apiEngine.msgClient.proto.variableManager;
|
|
11
|
-
|
|
12
|
-
m.registerVar("ApplicationContext", (Object[] args) -> reactContext.getApplicationContext());
|
|
13
|
-
m.registerVar("ReactApplicationContext", (Object[] args) -> reactContext);
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
m.registerVar("ApplicationContext",
|
|
13
|
+
(Object[] args) -> reactContext.getApplicationContext());
|
|
14
|
+
m.registerVar("ReactApplicationContext", (Object[] args) -> reactContext);
|
|
18
15
|
}
|
|
19
16
|
}
|
|
@@ -167,6 +167,7 @@ public class MixerManager {
|
|
|
167
167
|
MixerView mixerView = (MixerView)view;
|
|
168
168
|
mixerView.setBitmapCaptureCallback(null);
|
|
169
169
|
}
|
|
170
|
+
cachedMixedViews.remove(viewId);
|
|
170
171
|
|
|
171
172
|
pusher.getMixerManager().removeVideoStream(layout.streamId);
|
|
172
173
|
return true;
|
|
@@ -267,9 +268,6 @@ public class MixerManager {
|
|
|
267
268
|
} catch (Exception e) {
|
|
268
269
|
// Ignore
|
|
269
270
|
} finally {
|
|
270
|
-
if (bitmap != null && !bitmap.isRecycled()) {
|
|
271
|
-
bitmap.recycle();
|
|
272
|
-
}
|
|
273
271
|
textureMgr.cleanup();
|
|
274
272
|
}
|
|
275
273
|
}
|
|
@@ -150,7 +150,7 @@ public class MixerView extends FrameLayout {
|
|
|
150
150
|
|
|
151
151
|
private void startRealtimeCapture() {
|
|
152
152
|
long interval = (long)(1000f / captureFramerate);
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
captureRunnable = new Runnable() {
|
|
155
155
|
@Override
|
|
156
156
|
public void run() {
|
|
@@ -260,7 +260,7 @@ public class MixerView extends FrameLayout {
|
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
262
|
lastCaptureTime = currentTime;
|
|
263
|
-
|
|
263
|
+
|
|
264
264
|
synchronized (captureLock) {
|
|
265
265
|
if (isCapturing.compareAndSet(false, true)) {
|
|
266
266
|
Bitmap bitmap = null;
|
|
@@ -271,9 +271,16 @@ public class MixerView extends FrameLayout {
|
|
|
271
271
|
}
|
|
272
272
|
} catch (OutOfMemoryError e) {
|
|
273
273
|
System.gc();
|
|
274
|
+
// If an OOM occurs and the bitmap has not been passed to
|
|
275
|
+
// processBitmap, recycle it
|
|
276
|
+
if (bitmap != null && !bitmap.isRecycled()) {
|
|
277
|
+
bitmap.recycle();
|
|
278
|
+
}
|
|
279
|
+
} catch (Exception e) {
|
|
280
|
+
// If any other exception occurs and the bitmap has not been passed to
|
|
281
|
+
// processBitmap, recycle it
|
|
274
282
|
if (bitmap != null && !bitmap.isRecycled()) {
|
|
275
283
|
bitmap.recycle();
|
|
276
|
-
bitmap = null;
|
|
277
284
|
}
|
|
278
285
|
} finally {
|
|
279
286
|
isCapturing.set(false);
|
|
@@ -313,7 +320,7 @@ public class MixerView extends FrameLayout {
|
|
|
313
320
|
}
|
|
314
321
|
return;
|
|
315
322
|
}
|
|
316
|
-
|
|
323
|
+
|
|
317
324
|
// Call callback first if set (for MixerManager)
|
|
318
325
|
if (bitmapCaptureCallback != null) {
|
|
319
326
|
try {
|
|
@@ -321,7 +328,8 @@ public class MixerView extends FrameLayout {
|
|
|
321
328
|
bitmapCaptureCallback.onBitmapCaptured(bitmap);
|
|
322
329
|
} catch (Exception e) {
|
|
323
330
|
if (bitmapCaptureCallback != null) {
|
|
324
|
-
bitmapCaptureCallback.onCaptureError("Callback error: " +
|
|
331
|
+
bitmapCaptureCallback.onCaptureError("Callback error: " +
|
|
332
|
+
e.getMessage());
|
|
325
333
|
}
|
|
326
334
|
}
|
|
327
335
|
} else {
|
|
@@ -341,19 +349,23 @@ public class MixerView extends FrameLayout {
|
|
|
341
349
|
} catch (IllegalStateException e) {
|
|
342
350
|
// Ignore
|
|
343
351
|
}
|
|
344
|
-
|
|
345
|
-
// if no callback, recycle immediately to avoid accumulation
|
|
346
|
-
if (bitmap != null && !bitmap.isRecycled()) {
|
|
347
|
-
bitmap.recycle();
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
// Clean up old bitmap
|
|
353
355
|
if (lastBitmap != null && !lastBitmap.isRecycled()) {
|
|
354
356
|
lastBitmap.recycle();
|
|
355
357
|
}
|
|
356
|
-
|
|
358
|
+
|
|
359
|
+
// 如果没有设置回调,立即释放当前 bitmap 以避免内存累积
|
|
360
|
+
// 如果设置了回调,bitmap 将由回调的接收方负责管理
|
|
361
|
+
if (bitmapCaptureCallback == null) {
|
|
362
|
+
if (bitmap != null && !bitmap.isRecycled()) {
|
|
363
|
+
bitmap.recycle();
|
|
364
|
+
}
|
|
365
|
+
lastBitmap = null;
|
|
366
|
+
} else {
|
|
367
|
+
lastBitmap = bitmap;
|
|
368
|
+
}
|
|
357
369
|
}
|
|
358
370
|
|
|
359
371
|
public void handleCommand(String command, @Nullable ReadableArray args) {
|
|
@@ -384,7 +396,7 @@ public class MixerView extends FrameLayout {
|
|
|
384
396
|
MixerManager.onViewReady(viewId, this);
|
|
385
397
|
}
|
|
386
398
|
}
|
|
387
|
-
|
|
399
|
+
|
|
388
400
|
@Override
|
|
389
401
|
protected void onDetachedFromWindow() {
|
|
390
402
|
super.onDetachedFromWindow();
|
|
@@ -393,24 +405,23 @@ public class MixerView extends FrameLayout {
|
|
|
393
405
|
}
|
|
394
406
|
cleanup();
|
|
395
407
|
}
|
|
396
|
-
|
|
397
|
-
public void setViewId(String viewId) {
|
|
398
|
-
this.viewId = viewId;
|
|
408
|
+
|
|
409
|
+
public void setViewId(String viewId) {
|
|
410
|
+
this.viewId = viewId;
|
|
399
411
|
MixerManager.cachedMixedViews.put(viewId, this);
|
|
400
412
|
// 通知MixerManager视图已准备好,检查是否有待处理的回调
|
|
401
413
|
MixerManager.onViewReady(viewId, this);
|
|
402
414
|
}
|
|
403
415
|
|
|
404
416
|
// Add callback support for MixerManager integration
|
|
405
|
-
public void
|
|
417
|
+
public void
|
|
418
|
+
setBitmapCaptureCallback(MixerManager.BitmapCaptureCallback callback) {
|
|
406
419
|
this.bitmapCaptureCallback = callback;
|
|
407
420
|
}
|
|
408
421
|
|
|
409
422
|
// Public method for manual capture (called by MixerManager)
|
|
410
|
-
public void performManualCapture() {
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
423
|
+
public void performManualCapture() { performCapture("manual"); }
|
|
424
|
+
|
|
414
425
|
private void cleanup() {
|
|
415
426
|
isDestroyed.set(true);
|
|
416
427
|
stopCapture();
|
|
@@ -420,4 +431,4 @@ public class MixerView extends FrameLayout {
|
|
|
420
431
|
lastBitmap = null;
|
|
421
432
|
}
|
|
422
433
|
}
|
|
423
|
-
}
|
|
434
|
+
}
|
package/ios/VeLiveMixerHelper.h
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// Created by ByteDance on 2024/12/09.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
#import <Foundation/Foundation.h>
|
|
9
8
|
#import "VeLiveMixerView.h"
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
10
|
|
|
11
11
|
NS_ASSUME_NONNULL_BEGIN
|
|
12
12
|
|
|
@@ -17,9 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
17
17
|
@interface VeLiveMixerHelper : NSObject <VeLiveBitmapCaptureCallback>
|
|
18
18
|
|
|
19
19
|
// 对齐Android的static cachedMixedViews
|
|
20
|
-
@property
|
|
20
|
+
@property(class, nonatomic, strong)
|
|
21
|
+
NSMutableDictionary<NSString *, VeLiveMixerUIView *> *cachedMixedViews;
|
|
21
22
|
|
|
22
|
-
@property
|
|
23
|
+
@property(nonatomic, weak) VeLivePusher *pusher;
|
|
23
24
|
|
|
24
25
|
- (instancetype)initWithPusher:(VeLivePusher *)pusher;
|
|
25
26
|
|
|
@@ -31,7 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
31
32
|
- (void)captureView:(NSString *)viewId;
|
|
32
33
|
|
|
33
34
|
// Static方法 - 只保留Android中实际存在的
|
|
34
|
-
+ (void)setupCallbackForMixerView:(VeLiveMixerUIView *)mixerView
|
|
35
|
+
+ (void)setupCallbackForMixerView:(VeLiveMixerUIView *)mixerView
|
|
36
|
+
streamId:(int)streamId;
|
|
35
37
|
+ (void)sendBitmapToMixerStatic:(int)streamId bitmap:(UIImage *)bitmap;
|
|
36
38
|
+ (VeLiveMixerHelper *)findActiveMixerManager;
|
|
37
39
|
+ (void)onViewReady:(NSString *)viewId mixerView:(VeLiveMixerUIView *)mixerView;
|
|
@@ -41,4 +43,4 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
41
43
|
|
|
42
44
|
@end
|
|
43
45
|
|
|
44
|
-
NS_ASSUME_NONNULL_END
|
|
46
|
+
NS_ASSUME_NONNULL_END
|
package/ios/VeLiveMixerHelper.m
CHANGED
|
@@ -33,7 +33,7 @@ RCT_CUSTOM_VIEW_PROPERTY(viewId, NSString, VeLiveMixerUIView) {
|
|
|
33
33
|
if (json == nil) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
NSString *viewId = [RCTConvert NSString:json];
|
|
38
38
|
[view setViewId:viewId];
|
|
39
39
|
}
|
|
@@ -89,4 +89,4 @@ RCT_CUSTOM_VIEW_PROPERTY(autoSensitivity, NSNumber, VeLiveMixerUIView) {
|
|
|
89
89
|
[view setAutoSensitivity:sensitivity];
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
@end
|
|
92
|
+
@end
|