@byteplus/react-native-rtc 1.0.6 → 1.0.7-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 +8 -1
- package/android/src/main/java/com/volcengine/reactnative/vertc/VertcHelper.java +10 -0
- package/android/src/main/java/com/volcengine/reactnative/vertc/VertcModule.java +2 -0
- package/android/src/main/java/com/volcengine/reactnative/vertc/VertcView.java +1 -1
- package/android/src/main/java/com/volcengine/reactnative/vertc/VertcViewManager.java +1 -1
- package/android/src/main/java/com/volcengine/reactnative/vertc/live/VertcLive.java +143 -0
- package/android/src/main/java/com/volcengine/reactnative/vertc/vod/VertcVod.java +0 -5
- package/ios/VertcHelper.h +21 -0
- package/ios/VertcHelper.m +39 -0
- package/ios/live/VertcLive.h +24 -0
- package/ios/live/VertcLive.m +124 -0
- package/lib/commonjs/index.js +206 -11
- package/lib/module/index.js +206 -11
- package/lib/typescript/core/callback.d.ts +1 -1
- package/lib/typescript/core/rtc-video.d.ts +33 -1
- package/lib/typescript/core.d.ts +0 -4
- package/lib/typescript/interface.d.ts +53 -1
- package/lib/typescript/platforms/android/live.d.ts +8 -0
- package/lib/typescript/platforms/android/vertc.d.ts +2 -0
- package/lib/typescript/platforms/ios/live.d.ts +9 -0
- package/lib/typescript/platforms/ios/vertc.d.ts +10 -0
- package/package.json +1 -1
- package/react-native-rtc.podspec +5 -2
package/android/build.gradle
CHANGED
|
@@ -9,6 +9,8 @@ buildscript {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
def enableUnionForRTCWithLive = rootProject.ext.has('enableUnionForRTCWithLive') ? rootProject.ext.get('enableUnionForRTCWithLive') : false
|
|
13
|
+
|
|
12
14
|
def isNewArchitectureEnabled() {
|
|
13
15
|
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
14
16
|
}
|
|
@@ -51,7 +53,7 @@ def getNativeDep() {
|
|
|
51
53
|
def parsedJson = new groovy.json.JsonSlurper().parseText(packageJson.text)
|
|
52
54
|
def isBp = parsedJson.name.startsWith("@byteplus")
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
|
|
55
57
|
def rtcVersionToUse
|
|
56
58
|
if (isBp) {
|
|
57
59
|
rtcVersionToUse = enableUnionForRTCWithLive ? "3.58.1.20600" : "3.58.1.15100"
|
|
@@ -106,6 +108,7 @@ dependencies {
|
|
|
106
108
|
implementation "com.facebook.react:react-native:+"
|
|
107
109
|
|
|
108
110
|
implementation "com.volcengine:VolcApiEngine:1.6.2"
|
|
111
|
+
implementation project(':byteplus_react-native-live-push')
|
|
109
112
|
// implementation project(":hybrid-runtime");
|
|
110
113
|
|
|
111
114
|
// Use the RTC SDK dependency determined by getNativeDep() which can be overridden by customer's app build.gradle.
|
|
@@ -118,4 +121,8 @@ dependencies {
|
|
|
118
121
|
// byteplus com.bytedanceapi:ttsdk-player_premium:1.42.300.101 com.bytedanceapi:ttsdk-player_standard:1.42.300.101
|
|
119
122
|
def license_type = getLicenseType()
|
|
120
123
|
implementation "com.bytedanceapi:ttsdk-player_$license_type:1.+"
|
|
124
|
+
|
|
125
|
+
if (enableUnionForRTCWithLive) {
|
|
126
|
+
api 'com.bytedanceapi:ttsdk-ttlivepush_rtc:1.46.300.2'
|
|
127
|
+
}
|
|
121
128
|
}
|
|
@@ -8,9 +8,12 @@ import android.util.Log;
|
|
|
8
8
|
import com.ss.bytertc.engine.RTCVideo;
|
|
9
9
|
import com.ss.bytertc.engine.VideoEncoderConfig;
|
|
10
10
|
import com.ss.bytertc.engine.data.MirrorType;
|
|
11
|
+
import com.ss.bytertc.engine.live.IPushSingleStreamToCDNObserver;
|
|
12
|
+
import com.ss.bytertc.engine.live.PushSingleStreamParam;
|
|
11
13
|
|
|
12
14
|
public class VertcHelper {
|
|
13
15
|
|
|
16
|
+
final public String TAG = "VertcHelper";
|
|
14
17
|
static public VertcHelper sInstance = new VertcHelper();
|
|
15
18
|
|
|
16
19
|
public static VertcHelper getInstance() {
|
|
@@ -24,4 +27,11 @@ public class VertcHelper {
|
|
|
24
27
|
public int invokeSetLocalVideoMirrorType(RTCVideo engine, int mirrorType) {
|
|
25
28
|
return engine.setLocalVideoMirrorType(MirrorType.fromId(mirrorType));
|
|
26
29
|
}
|
|
30
|
+
|
|
31
|
+
public int invokeStartPushSingleStreamToCDN(RTCVideo engine, String taskId, PushSingleStreamParam param) {
|
|
32
|
+
IPushSingleStreamToCDNObserver observer = (eventType, taskId1, error) -> {
|
|
33
|
+
Log.d(TAG, "StartPushSingleStreamToCDN: " + eventType + " " + taskId1 + " " + error);
|
|
34
|
+
};
|
|
35
|
+
return engine.startPushSingleStreamToCDN(taskId, param, observer);
|
|
36
|
+
}
|
|
27
37
|
}
|
|
@@ -72,7 +72,7 @@ public class VertcViewManager extends SimpleViewManager<VertcView> implements Vo
|
|
|
72
72
|
|
|
73
73
|
public Map getExportedCustomBubblingEventTypeConstants() {
|
|
74
74
|
return MapBuilder.builder().put(
|
|
75
|
-
"
|
|
75
|
+
"vertcLoad",
|
|
76
76
|
MapBuilder.of(
|
|
77
77
|
"phasedRegistrationNames",
|
|
78
78
|
MapBuilder.of("bubbled", "onViewLoad")
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
package com.volcengine.reactnative.vertc.live;
|
|
5
|
+
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
|
|
8
|
+
import com.ss.avframework.live.VeLivePusherDef;
|
|
9
|
+
import com.ss.avframework.live.VeLiveVideoFrame;
|
|
10
|
+
import com.ss.avframework.opengl.RendererCommon;
|
|
11
|
+
import com.ss.bytertc.engine.RTCVideo;
|
|
12
|
+
import com.ss.avframework.live.VeLivePusher;
|
|
13
|
+
import com.ss.bytertc.engine.data.ReturnStatus;
|
|
14
|
+
import com.ss.bytertc.engine.data.StreamIndex;
|
|
15
|
+
import com.ss.bytertc.engine.data.VideoPixelFormat;
|
|
16
|
+
import com.ss.bytertc.engine.data.VideoRotation;
|
|
17
|
+
import com.ss.bytertc.engine.data.VideoSourceType;
|
|
18
|
+
import java.util.concurrent.TimeUnit;
|
|
19
|
+
import com.ss.bytertc.engine.video.builder.GLTextureVideoFrameBuilder;
|
|
20
|
+
import com.volcengine.velive.rn.push.VeLivePushHelper;
|
|
21
|
+
|
|
22
|
+
import javax.annotation.Nonnull;
|
|
23
|
+
|
|
24
|
+
public class VertcLive {
|
|
25
|
+
private String TAG = "VertcLive";
|
|
26
|
+
|
|
27
|
+
private VeLivePusher mLivePusher;
|
|
28
|
+
private VeLivePusherDef.VeLiveVideoFrameListener mListener;
|
|
29
|
+
private org.json.JSONObject mOptions;
|
|
30
|
+
private RTCVideo mEngine;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @brief Start to capture live stream.
|
|
34
|
+
*/
|
|
35
|
+
public int startLiveVideoCapture(RTCVideo engine, String pusherViewId, org.json.JSONObject options) {
|
|
36
|
+
try {
|
|
37
|
+
stopLiveVideoCapture();
|
|
38
|
+
|
|
39
|
+
mEngine = engine;
|
|
40
|
+
mOptions = options;
|
|
41
|
+
|
|
42
|
+
mLivePusher = getVeLivePusher(pusherViewId);
|
|
43
|
+
if (mLivePusher == null) {
|
|
44
|
+
throw new RuntimeException("[Unknown LivePusher] can't find pusher instance by view id.");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// set video source as external
|
|
48
|
+
engine.setVideoSourceType(getStreamIndex(), VideoSourceType.VIDEO_SOURCE_TYPE_EXTERNAL);
|
|
49
|
+
// set video frame listener
|
|
50
|
+
mListener = new VeLivePusherDef.VeLiveVideoFrameListener() {
|
|
51
|
+
@Nonnull
|
|
52
|
+
@Override
|
|
53
|
+
public VeLivePusherDef.VeLiveVideoFrameSource getObservedVideoFrameSource() {
|
|
54
|
+
return new VeLivePusherDef.VeLiveVideoFrameSource(VeLivePusherDef.VeLiveVideoFrameSource.VeLiveVideoFrameSourcePreEncode);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
public void onPreEncodeVideoFrame(VeLiveVideoFrame frame) {
|
|
59
|
+
int ret_status = -1;
|
|
60
|
+
StreamIndex streamIndex = getStreamIndex();
|
|
61
|
+
|
|
62
|
+
float[] mMVPMatrix = RendererCommon.convertMatrixFromAndroidGraphicsMatrix(frame.getTextureMatrix());
|
|
63
|
+
GLTextureVideoFrameBuilder builder = new GLTextureVideoFrameBuilder(
|
|
64
|
+
frame.isOesTextureFrame() ? VideoPixelFormat.TEXTURE_OES : VideoPixelFormat.TEXTURE_2D
|
|
65
|
+
)
|
|
66
|
+
.setTextureID(frame.getTextureId())
|
|
67
|
+
.setWidth(frame.getWidth())
|
|
68
|
+
.setHeight(frame.getHeight())
|
|
69
|
+
.setRotation(VideoRotation.VIDEO_ROTATION_0)
|
|
70
|
+
.setTextureMatrix(mMVPMatrix)
|
|
71
|
+
.setEGLContext(VeLivePusher.getEGLContext())
|
|
72
|
+
.setTimeStampUs(System.currentTimeMillis() * TimeUnit.MILLISECONDS.toNanos(1));
|
|
73
|
+
|
|
74
|
+
if (streamIndex == StreamIndex.STREAM_INDEX_MAIN) {
|
|
75
|
+
ret_status = engine.pushExternalVideoFrame(builder.build());
|
|
76
|
+
}
|
|
77
|
+
if (streamIndex == StreamIndex.STREAM_INDEX_SCREEN) {
|
|
78
|
+
ret_status = engine.pushScreenVideoFrame(builder.build());
|
|
79
|
+
}
|
|
80
|
+
boolean result = ret_status == ReturnStatus.RETURN_STATUS_SUCCESS.value()
|
|
81
|
+
|| ret_status == ReturnStatus.RETURN_STATUS_VIDEO_TIMESTAMP_WARNING.value();
|
|
82
|
+
if (!result) {
|
|
83
|
+
Log.d(TAG, "Push external frame fail: " + ret_status);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
mLivePusher.addVideoFrameListener(mListener);
|
|
88
|
+
|
|
89
|
+
return 0;
|
|
90
|
+
} catch (Exception err) {
|
|
91
|
+
Log.d(TAG, "startLiveVideoCapture failed:" + err.getMessage());
|
|
92
|
+
throw new RuntimeException(err);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @brief Stop to capture live stream.
|
|
98
|
+
*/
|
|
99
|
+
public int stopLiveVideoCapture() {
|
|
100
|
+
try {
|
|
101
|
+
if (
|
|
102
|
+
mOptions == null ||
|
|
103
|
+
mEngine == null
|
|
104
|
+
) {
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// reset sourceType to Internal
|
|
109
|
+
mEngine.setVideoSourceType(getStreamIndex(), VideoSourceType.VIDEO_SOURCE_TYPE_INTERNAL);
|
|
110
|
+
|
|
111
|
+
// release listener
|
|
112
|
+
mLivePusher.removeVideoFrameListener(mListener);
|
|
113
|
+
mListener = null;
|
|
114
|
+
mOptions = null;
|
|
115
|
+
mLivePusher = null;
|
|
116
|
+
mEngine = null;
|
|
117
|
+
|
|
118
|
+
return 0;
|
|
119
|
+
} catch (Exception err) {
|
|
120
|
+
Log.d(TAG, "stopLiveVideoCapture failed:" + err.getMessage());
|
|
121
|
+
throw new RuntimeException(err);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Get VeLivePusher from Object
|
|
127
|
+
private VeLivePusher getVeLivePusher(String pusherViewId) {
|
|
128
|
+
|
|
129
|
+
if (VeLivePushHelper.getPusher(pusherViewId) != null) {
|
|
130
|
+
return VeLivePushHelper.getPusher(pusherViewId);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Get StreamIndex from options
|
|
137
|
+
private StreamIndex getStreamIndex() {
|
|
138
|
+
Number index = mOptions.optInt("streamIndex", StreamIndex.STREAM_INDEX_MAIN.value());
|
|
139
|
+
StreamIndex streamIndex = StreamIndex.fromId(index.intValue());
|
|
140
|
+
Log.d(TAG, "getStreamIndex:" + streamIndex);
|
|
141
|
+
return streamIndex;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -136,11 +136,6 @@ public class VertcVod {
|
|
|
136
136
|
if (arg instanceof TTVideoEngine) {
|
|
137
137
|
return (TTVideoEngine)arg;
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
Object decoded = VolcApiEnginePool.getInstance().decodeArg(arg, null);
|
|
141
|
-
if (decoded instanceof TTVideoEngine) {
|
|
142
|
-
return (TTVideoEngine)arg;
|
|
143
|
-
}
|
|
144
139
|
|
|
145
140
|
return null;
|
|
146
141
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// Pods
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "RTCHeader.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@interface VertcHelper : NSObject
|
|
12
|
+
|
|
13
|
+
+ (instancetype) getInstance;
|
|
14
|
+
|
|
15
|
+
- (void)onStreamPushEvent:(ByteRTCSingleStreamPushEvent)event
|
|
16
|
+
taskId:(NSString *_Nonnull)taskID
|
|
17
|
+
error:(NSInteger)errorCode;
|
|
18
|
+
|
|
19
|
+
- (int) invokeStartPushSingleStreamToCDN:(ByteRTCVideo *)rtc taskId:(NSString *_Nonnull)taskID singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream;
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// react-native-rtc
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RTCHeader.h"
|
|
10
|
+
#import <TTSDKFramework/TTSDKFramework.h>
|
|
11
|
+
#import <VertcHelper.h>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#pragma mark - Helper
|
|
15
|
+
@implementation VertcHelper
|
|
16
|
+
|
|
17
|
+
+ (instancetype) getInstance {
|
|
18
|
+
static VertcHelper *instance = nil;
|
|
19
|
+
static dispatch_once_t onceToken;
|
|
20
|
+
dispatch_once(&onceToken, ^{
|
|
21
|
+
instance = [[VertcHelper alloc] init];
|
|
22
|
+
});
|
|
23
|
+
return instance;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)onStreamPushEvent:(ByteRTCSingleStreamPushEvent)event
|
|
27
|
+
taskId:(NSString *_Nonnull)taskID
|
|
28
|
+
error:(NSInteger)errorCode {
|
|
29
|
+
NSLog(@"startPushSingleStreamToCDN: event=%ld, taskID=%@, error=%ld", (long)event, taskID, (long)errorCode);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (int)invokeStartPushSingleStreamToCDN:(ByteRTCVideo *)rtc taskId:(NSString *_Nonnull)taskID singleStream:(ByteRTCPushSingleStreamParam *_Nonnull)singleStream {
|
|
33
|
+
singleStream.pushType = ByteRTCSingleStreamPushToCDN;
|
|
34
|
+
singleStream.isScreen = singleStream.isScreen || false;
|
|
35
|
+
int res = [rtc startPushSingleStreamToCDN:taskID singleStream:singleStream observer:self];
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// VertcLive.h
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import "RTCHeader.h"
|
|
10
|
+
#import <TTSDKFramework/TTSDKFramework.h>
|
|
11
|
+
|
|
12
|
+
@interface VertcLive : NSObject
|
|
13
|
+
|
|
14
|
+
- (int) startLiveVideoCapture:(ByteRTCVideo *)rtc viewId:(NSString *)viewId options:(NSDictionary *)options;
|
|
15
|
+
|
|
16
|
+
- (int) stopLiveVideoCapture;
|
|
17
|
+
|
|
18
|
+
- (VeLiveVideoFrameSource)getObservedVideoFrameSource;
|
|
19
|
+
|
|
20
|
+
- (ByteRTCVideoPixelFormat)convertToRtcPixelFormat:(VeLivePixelFormat)format;
|
|
21
|
+
|
|
22
|
+
- (void)onPreEncodeVideoFrame:(VeLiveVideoFrame *)frame;
|
|
23
|
+
|
|
24
|
+
@end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
#import "VertcLive.h"
|
|
5
|
+
#import "RTCHeader.h"
|
|
6
|
+
#import <TTSDKFramework/TTSDKFramework.h>
|
|
7
|
+
#import <TTSDKFramework/VeLivePusherDef.h>
|
|
8
|
+
#import "VeLivePushHelper.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@interface VertcLive ()
|
|
13
|
+
|
|
14
|
+
@property (nonatomic, strong) NSDictionary *options;
|
|
15
|
+
@property (nonatomic, strong) ByteRTCVideo *rtcEngine;
|
|
16
|
+
@property (nonatomic, strong) VeLivePusher *livePusher;
|
|
17
|
+
@property (nonatomic, strong) id<VeLiveVideoFrameListener> videoFrameListener;
|
|
18
|
+
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
@implementation VertcLive
|
|
22
|
+
|
|
23
|
+
- (void)dealloc {
|
|
24
|
+
if (self.livePusher && self.videoFrameListener) {
|
|
25
|
+
[self.livePusher removeVideoFrameListener:self.videoFrameListener];
|
|
26
|
+
}
|
|
27
|
+
self.livePusher = nil;
|
|
28
|
+
self.rtcEngine = nil;
|
|
29
|
+
self.options = nil;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (int)startLiveVideoCapture:(ByteRTCVideo *)rtc viewId:(NSString *)viewId options:(NSDictionary *)options {
|
|
33
|
+
|
|
34
|
+
VeLivePusher *pusher = [VeLivePushHelper getPusher:viewId];
|
|
35
|
+
if (pusher == nil) {
|
|
36
|
+
@throw [NSException exceptionWithName:@"unknown videoEngine" reason:@"can't get pusher" userInfo:@{}];
|
|
37
|
+
}
|
|
38
|
+
self.rtcEngine = rtc;
|
|
39
|
+
self.options = options;
|
|
40
|
+
self.livePusher = pusher;
|
|
41
|
+
|
|
42
|
+
NSInteger streamIndexValue = [options[@"streamIndex"] integerValue] ?: 0;
|
|
43
|
+
ByteRTCStreamIndex streamIndex = (streamIndexValue == 1) ? ByteRTCStreamIndexScreen : ByteRTCStreamIndexMain;
|
|
44
|
+
[rtc setVideoSourceType:ByteRTCVideoSourceTypeExternal WithStreamIndex:streamIndex];
|
|
45
|
+
|
|
46
|
+
int addRes = [self.livePusher addVideoFrameListener:self];
|
|
47
|
+
NSLog(@"addVideoFrameListener result: %d", addRes);
|
|
48
|
+
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (int)stopLiveVideoCapture {
|
|
53
|
+
if (self.rtcEngine == nil || self.livePusher == nil) {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
if (self.livePusher && self.videoFrameListener) {
|
|
57
|
+
[self.livePusher removeVideoFrameListener:self.videoFrameListener];
|
|
58
|
+
self.videoFrameListener = nil;
|
|
59
|
+
}
|
|
60
|
+
NSInteger streamIndexValue = [self.options[@"streamIndex"] integerValue] ?: 0;
|
|
61
|
+
ByteRTCStreamIndex streamIndex = (streamIndexValue == 1) ? ByteRTCStreamIndexScreen : ByteRTCStreamIndexMain;
|
|
62
|
+
[self.rtcEngine setVideoSourceType:ByteRTCVideoSourceTypeInternal WithStreamIndex:streamIndex];
|
|
63
|
+
|
|
64
|
+
[self.livePusher removeVideoFrameListener:self];
|
|
65
|
+
|
|
66
|
+
self.options = nil;
|
|
67
|
+
self.rtcEngine = nil;
|
|
68
|
+
self.livePusher = nil;
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (VeLiveVideoFrameSource)getObservedVideoFrameSource {
|
|
73
|
+
return VeLiveVideoFrameSourcePreEncode;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (ByteRTCVideoPixelFormat)convertToRtcPixelFormat:(VeLivePixelFormat)format {
|
|
77
|
+
switch (format) {
|
|
78
|
+
case VeLivePixelFormatBGRA32: return ByteRTCVideoPixelFormatBGRA;
|
|
79
|
+
case VeLivePixelFormatNV12: return ByteRTCVideoPixelFormatNV12;
|
|
80
|
+
case VeLivePixelFormatNV21: return ByteRTCVideoPixelFormatNV21;
|
|
81
|
+
case VeLivePixelFormatI420: return ByteRTCVideoPixelFormatI420;
|
|
82
|
+
case VeLivePixelFormat2DTexture: return ByteRTCVideoPixelFormatGLTexture2D;
|
|
83
|
+
case VeLiveVideoBufferTypeUnKnown: return ByteRTCVideoPixelFormatUnknown;
|
|
84
|
+
}
|
|
85
|
+
return ByteRTCVideoPixelFormatUnknown;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
- (void)onPreEncodeVideoFrame:(VeLiveVideoFrame *)frame {
|
|
89
|
+
|
|
90
|
+
NSInteger streamIndexValue = [self.options[@"streamIndex"] integerValue] ?: 0;
|
|
91
|
+
ByteRTCStreamIndex streamIndex = (streamIndexValue == 1) ? ByteRTCStreamIndexScreen : ByteRTCStreamIndexMain;
|
|
92
|
+
|
|
93
|
+
int res = 0;
|
|
94
|
+
if (streamIndex == ByteRTCStreamIndexMain) {
|
|
95
|
+
ByteRTCVideoPixelFormat pixelFormat = [self convertToRtcPixelFormat:frame.pixelFormat];
|
|
96
|
+
ByteRTCVideoFrame *videoFrame = [[ByteRTCVideoFrame alloc] init];
|
|
97
|
+
videoFrame.width = frame.width;
|
|
98
|
+
videoFrame.height = frame.height;
|
|
99
|
+
videoFrame.format = (int)pixelFormat;
|
|
100
|
+
videoFrame.time = frame.pts;
|
|
101
|
+
// videoFrame.contentType = ByteRTCVideoContentTypeNormalFrame;
|
|
102
|
+
// same enum
|
|
103
|
+
videoFrame.rotation = (ByteRTCVideoRotation)frame.rotation;
|
|
104
|
+
|
|
105
|
+
if (frame.sampleBuffer) {
|
|
106
|
+
videoFrame.textureBuf = CMSampleBufferGetImageBuffer(frame.sampleBuffer);
|
|
107
|
+
videoFrame.time = CMSampleBufferGetPresentationTimeStamp(frame.sampleBuffer);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (frame.pixelBuffer) {
|
|
111
|
+
videoFrame.textureBuf = frame.pixelBuffer;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
res = [self.rtcEngine pushExternalVideoFrame: videoFrame];
|
|
115
|
+
}
|
|
116
|
+
if (streamIndex == ByteRTCStreamIndexScreen) {
|
|
117
|
+
res = [self.rtcEngine pushScreenVideoFrame:frame.pixelBuffer time:frame.pts rotation:frame.rotation];
|
|
118
|
+
}
|
|
119
|
+
if (res != 0 && res != -202) {
|
|
120
|
+
NSLog(@"bytertc push video frame fail return '%d'", res);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@end
|
package/lib/commonjs/index.js
CHANGED
|
@@ -68201,7 +68201,83 @@ var VertcVod = function () {
|
|
|
68201
68201
|
return _classThis;
|
|
68202
68202
|
}();
|
|
68203
68203
|
|
|
68204
|
-
var
|
|
68204
|
+
var VertcLive$1 = function () {
|
|
68205
|
+
var _classDecorators = [NativeClass('com.volcengine.reactnative.vertc.live.VertcLive')];
|
|
68206
|
+
var _classDescriptor;
|
|
68207
|
+
var _classExtraInitializers = [];
|
|
68208
|
+
var _classThis;
|
|
68209
|
+
var _instanceExtraInitializers = [];
|
|
68210
|
+
var _startLiveVideoCapture_decorators;
|
|
68211
|
+
var _stopLiveVideoCapture_decorators;
|
|
68212
|
+
_classThis = /** @class */ (function () {
|
|
68213
|
+
function VertcLive_1() {
|
|
68214
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68215
|
+
}
|
|
68216
|
+
VertcLive_1.prototype.startLiveVideoCapture = function (video, viewId, options) {
|
|
68217
|
+
throw new Error('not implement');
|
|
68218
|
+
};
|
|
68219
|
+
VertcLive_1.prototype.stopLiveVideoCapture = function () {
|
|
68220
|
+
throw new Error('not implement');
|
|
68221
|
+
};
|
|
68222
|
+
return VertcLive_1;
|
|
68223
|
+
}());
|
|
68224
|
+
__setFunctionName(_classThis, "VertcLive");
|
|
68225
|
+
(function () {
|
|
68226
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68227
|
+
_startLiveVideoCapture_decorators = [NativeMethod()];
|
|
68228
|
+
_stopLiveVideoCapture_decorators = [NativeMethod()];
|
|
68229
|
+
__esDecorate(_classThis, null, _startLiveVideoCapture_decorators, { kind: "method", name: "startLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "startLiveVideoCapture" in obj; }, get: function (obj) { return obj.startLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68230
|
+
__esDecorate(_classThis, null, _stopLiveVideoCapture_decorators, { kind: "method", name: "stopLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "stopLiveVideoCapture" in obj; }, get: function (obj) { return obj.stopLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68231
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68232
|
+
_classThis = _classDescriptor.value;
|
|
68233
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68234
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68235
|
+
})();
|
|
68236
|
+
return _classThis;
|
|
68237
|
+
}();
|
|
68238
|
+
|
|
68239
|
+
var VertcLive = function () {
|
|
68240
|
+
var _classDecorators = [NativeClass('VertcLive')];
|
|
68241
|
+
var _classDescriptor;
|
|
68242
|
+
var _classExtraInitializers = [];
|
|
68243
|
+
var _classThis;
|
|
68244
|
+
var _instanceExtraInitializers = [];
|
|
68245
|
+
var _init_decorators;
|
|
68246
|
+
var _startLiveVideoCapture_decorators;
|
|
68247
|
+
var _stopLiveVideoCapture_decorators;
|
|
68248
|
+
_classThis = /** @class */ (function () {
|
|
68249
|
+
function VertcLive_1() {
|
|
68250
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68251
|
+
}
|
|
68252
|
+
VertcLive_1.prototype.init = function () {
|
|
68253
|
+
throw new Error('not implement');
|
|
68254
|
+
};
|
|
68255
|
+
VertcLive_1.prototype.startLiveVideoCapture = function (video, viewId, options) {
|
|
68256
|
+
throw new Error('not implement');
|
|
68257
|
+
};
|
|
68258
|
+
VertcLive_1.prototype.stopLiveVideoCapture = function () {
|
|
68259
|
+
throw new Error('not implement');
|
|
68260
|
+
};
|
|
68261
|
+
return VertcLive_1;
|
|
68262
|
+
}());
|
|
68263
|
+
__setFunctionName(_classThis, "VertcLive");
|
|
68264
|
+
(function () {
|
|
68265
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68266
|
+
_init_decorators = [NativeMethodSync('init')];
|
|
68267
|
+
_startLiveVideoCapture_decorators = [NativeMethod('startLiveVideoCapture:viewId:options:')];
|
|
68268
|
+
_stopLiveVideoCapture_decorators = [NativeMethod('stopLiveVideoCapture')];
|
|
68269
|
+
__esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68270
|
+
__esDecorate(_classThis, null, _startLiveVideoCapture_decorators, { kind: "method", name: "startLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "startLiveVideoCapture" in obj; }, get: function (obj) { return obj.startLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68271
|
+
__esDecorate(_classThis, null, _stopLiveVideoCapture_decorators, { kind: "method", name: "stopLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "stopLiveVideoCapture" in obj; }, get: function (obj) { return obj.stopLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68272
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68273
|
+
_classThis = _classDescriptor.value;
|
|
68274
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68275
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68276
|
+
})();
|
|
68277
|
+
return _classThis;
|
|
68278
|
+
}();
|
|
68279
|
+
|
|
68280
|
+
var VertcHelper$1 = function () {
|
|
68205
68281
|
var _classDecorators = [NativeClass('com.volcengine.reactnative.vertc.VertcHelper')];
|
|
68206
68282
|
var _classDescriptor;
|
|
68207
68283
|
var _classExtraInitializers = [];
|
|
@@ -68212,6 +68288,7 @@ var VertcHelper = function () {
|
|
|
68212
68288
|
var _static_getInstance_decorators;
|
|
68213
68289
|
var _invokeSetVideoEncoderConfig_decorators;
|
|
68214
68290
|
var _invokeSetLocalVideoMirrorType_decorators;
|
|
68291
|
+
var _invokeStartPushSingleStreamToCDN_decorators;
|
|
68215
68292
|
var VertcHelper = _classThis = /** @class */ (function (_super) {
|
|
68216
68293
|
__extends(VertcHelper_1, _super);
|
|
68217
68294
|
function VertcHelper_1() {
|
|
@@ -68228,6 +68305,9 @@ var VertcHelper = function () {
|
|
|
68228
68305
|
VertcHelper_1.prototype.invokeSetLocalVideoMirrorType = function (video, mirrorType) {
|
|
68229
68306
|
throw new Error('not implement');
|
|
68230
68307
|
};
|
|
68308
|
+
VertcHelper_1.prototype.invokeStartPushSingleStreamToCDN = function (video, taskId, param) {
|
|
68309
|
+
throw new Error('not implement');
|
|
68310
|
+
};
|
|
68231
68311
|
return VertcHelper_1;
|
|
68232
68312
|
}(_classSuper));
|
|
68233
68313
|
__setFunctionName(_classThis, "VertcHelper");
|
|
@@ -68237,9 +68317,54 @@ var VertcHelper = function () {
|
|
|
68237
68317
|
_static_getInstance_decorators = [ReturnClass(function () { return VertcHelper; }), NativeStaticMethodSync()];
|
|
68238
68318
|
_invokeSetVideoEncoderConfig_decorators = [NativeMethod()];
|
|
68239
68319
|
_invokeSetLocalVideoMirrorType_decorators = [NativeMethod()];
|
|
68320
|
+
_invokeStartPushSingleStreamToCDN_decorators = [NativeMethod()];
|
|
68240
68321
|
__esDecorate(_classThis, null, _static_getInstance_decorators, { kind: "method", name: "getInstance", static: true, private: false, access: { has: function (obj) { return "getInstance" in obj; }, get: function (obj) { return obj.getInstance; } }, metadata: _metadata }, null, _staticExtraInitializers);
|
|
68241
68322
|
__esDecorate(_classThis, null, _invokeSetVideoEncoderConfig_decorators, { kind: "method", name: "invokeSetVideoEncoderConfig", static: false, private: false, access: { has: function (obj) { return "invokeSetVideoEncoderConfig" in obj; }, get: function (obj) { return obj.invokeSetVideoEncoderConfig; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68242
68323
|
__esDecorate(_classThis, null, _invokeSetLocalVideoMirrorType_decorators, { kind: "method", name: "invokeSetLocalVideoMirrorType", static: false, private: false, access: { has: function (obj) { return "invokeSetLocalVideoMirrorType" in obj; }, get: function (obj) { return obj.invokeSetLocalVideoMirrorType; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68324
|
+
__esDecorate(_classThis, null, _invokeStartPushSingleStreamToCDN_decorators, { kind: "method", name: "invokeStartPushSingleStreamToCDN", static: false, private: false, access: { has: function (obj) { return "invokeStartPushSingleStreamToCDN" in obj; }, get: function (obj) { return obj.invokeStartPushSingleStreamToCDN; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68325
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68326
|
+
VertcHelper = _classThis = _classDescriptor.value;
|
|
68327
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68328
|
+
__runInitializers(_classThis, _staticExtraInitializers);
|
|
68329
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68330
|
+
})();
|
|
68331
|
+
return VertcHelper = _classThis;
|
|
68332
|
+
}();
|
|
68333
|
+
|
|
68334
|
+
var VertcHelper = function () {
|
|
68335
|
+
var _classDecorators = [NativeClass('VertcHelper')];
|
|
68336
|
+
var _classDescriptor;
|
|
68337
|
+
var _classExtraInitializers = [];
|
|
68338
|
+
var _classThis;
|
|
68339
|
+
var _staticExtraInitializers = [];
|
|
68340
|
+
var _instanceExtraInitializers = [];
|
|
68341
|
+
var _static_getInstance_decorators;
|
|
68342
|
+
var _init_decorators;
|
|
68343
|
+
var _invokeStartPushSingleStreamToCDN_decorators;
|
|
68344
|
+
var VertcHelper = _classThis = /** @class */ (function () {
|
|
68345
|
+
function VertcHelper_1() {
|
|
68346
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68347
|
+
}
|
|
68348
|
+
VertcHelper_1.prototype.init = function () {
|
|
68349
|
+
throw new Error('not implement');
|
|
68350
|
+
};
|
|
68351
|
+
VertcHelper_1.getInstance = function () {
|
|
68352
|
+
throw new Error('not implement');
|
|
68353
|
+
};
|
|
68354
|
+
VertcHelper_1.prototype.invokeStartPushSingleStreamToCDN = function (video, taskId, param) {
|
|
68355
|
+
throw new Error('not implement');
|
|
68356
|
+
};
|
|
68357
|
+
return VertcHelper_1;
|
|
68358
|
+
}());
|
|
68359
|
+
__setFunctionName(_classThis, "VertcHelper");
|
|
68360
|
+
(function () {
|
|
68361
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68362
|
+
_init_decorators = [NativeMethodSync('init')];
|
|
68363
|
+
_static_getInstance_decorators = [ReturnClass(function () { return VertcHelper; }), NativeStaticMethodSync('getInstance')];
|
|
68364
|
+
_invokeStartPushSingleStreamToCDN_decorators = [NativeMethod('invokeStartPushSingleStreamToCDN:taskId:singleStream:')];
|
|
68365
|
+
__esDecorate(_classThis, null, _static_getInstance_decorators, { kind: "method", name: "getInstance", static: true, private: false, access: { has: function (obj) { return "getInstance" in obj; }, get: function (obj) { return obj.getInstance; } }, metadata: _metadata }, null, _staticExtraInitializers);
|
|
68366
|
+
__esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68367
|
+
__esDecorate(_classThis, null, _invokeStartPushSingleStreamToCDN_decorators, { kind: "method", name: "invokeStartPushSingleStreamToCDN", static: false, private: false, access: { has: function (obj) { return "invokeStartPushSingleStreamToCDN" in obj; }, get: function (obj) { return obj.invokeStartPushSingleStreamToCDN; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68243
68368
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68244
68369
|
VertcHelper = _classThis = _classDescriptor.value;
|
|
68245
68370
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -68307,15 +68432,17 @@ extendsClassMember(RemoteVideoStats, 'codecType')(function () {
|
|
|
68307
68432
|
});
|
|
68308
68433
|
extendsClassMethod(android_RTCRoomEventHandler, 'onStreamRemove', function () {
|
|
68309
68434
|
return function impl(stream, reason) {
|
|
68435
|
+
var _a, _b;
|
|
68310
68436
|
if (this._instance.onStreamRemove) {
|
|
68311
|
-
this._instance.onStreamRemove(packObject(stream, RTCStream), t_StreamRemoveReason.android_to_ts(reason));
|
|
68437
|
+
(_b = (_a = this._instance).onStreamRemove) === null || _b === void 0 ? void 0 : _b.call(_a, packObject(stream, RTCStream), t_StreamRemoveReason.android_to_ts(reason));
|
|
68312
68438
|
}
|
|
68313
68439
|
};
|
|
68314
68440
|
});
|
|
68315
68441
|
extendsClassMethod(ios_RTCRoomEventHandler, 'rtcRoom$onStreamRemove$stream$reason', function () {
|
|
68316
68442
|
return function impl(rtcRoom, uid, stream, reason) {
|
|
68443
|
+
var _a, _b;
|
|
68317
68444
|
if (this._instance.onStreamRemove) {
|
|
68318
|
-
this._instance.onStreamRemove(packObject(stream, RTCStream), t_StreamRemoveReason.ios_to_ts(reason));
|
|
68445
|
+
(_b = (_a = this._instance).onStreamRemove) === null || _b === void 0 ? void 0 : _b.call(_a, packObject(stream, RTCStream), t_StreamRemoveReason.ios_to_ts(reason));
|
|
68319
68446
|
}
|
|
68320
68447
|
};
|
|
68321
68448
|
});
|
|
@@ -68483,11 +68610,52 @@ extendsClassMethod(RTCVideo, 'stopVodPlayerCapture', function () {
|
|
|
68483
68610
|
}
|
|
68484
68611
|
};
|
|
68485
68612
|
});
|
|
68613
|
+
var LiveHelperKey = '_live';
|
|
68614
|
+
extendsClassMethod(RTCVideo, 'startLiveVideoCapture', function () {
|
|
68615
|
+
return function impl(viewId, options) {
|
|
68616
|
+
var _this = this;
|
|
68617
|
+
if (options === void 0) { options = {}; }
|
|
68618
|
+
if (!viewId) {
|
|
68619
|
+
throw new Error('Live player view id is required.');
|
|
68620
|
+
}
|
|
68621
|
+
var a = function () {
|
|
68622
|
+
var androidRtc = unpackObject(_this);
|
|
68623
|
+
var ins = new VertcLive$1();
|
|
68624
|
+
_this[LiveHelperKey] = ins;
|
|
68625
|
+
return ins.startLiveVideoCapture(androidRtc, viewId, options);
|
|
68626
|
+
};
|
|
68627
|
+
var i = function () {
|
|
68628
|
+
var iosRtc = unpackObject(_this);
|
|
68629
|
+
var ins = new VertcLive();
|
|
68630
|
+
_this[LiveHelperKey] = ins;
|
|
68631
|
+
return ins.startLiveVideoCapture(iosRtc, viewId, options);
|
|
68632
|
+
};
|
|
68633
|
+
var $os = env.getOS();
|
|
68634
|
+
if ($os === 'android') {
|
|
68635
|
+
return a();
|
|
68636
|
+
}
|
|
68637
|
+
else if ($os === 'ios') {
|
|
68638
|
+
return i();
|
|
68639
|
+
}
|
|
68640
|
+
else {
|
|
68641
|
+
throw new Error('Not Support Platform ' + $os);
|
|
68642
|
+
}
|
|
68643
|
+
};
|
|
68644
|
+
});
|
|
68645
|
+
extendsClassMethod(RTCVideo, 'stopLiveVideoCapture', function () {
|
|
68646
|
+
return function impl() {
|
|
68647
|
+
var ins = this[LiveHelperKey];
|
|
68648
|
+
if (!ins) {
|
|
68649
|
+
return -2;
|
|
68650
|
+
}
|
|
68651
|
+
return ins.stopLiveVideoCapture();
|
|
68652
|
+
};
|
|
68653
|
+
});
|
|
68486
68654
|
extendsClassMethod(RTCVideo, 'setVideoEncoderConfig', function (origin) {
|
|
68487
68655
|
return function impl(channelSolutions) {
|
|
68488
68656
|
var _this = this;
|
|
68489
68657
|
var a = function () {
|
|
68490
|
-
var vertc = VertcHelper.getInstance();
|
|
68658
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68491
68659
|
return vertc.invokeSetVideoEncoderConfig(unpackObject(_this), channelSolutions.map(function (item) { return unpackObject(item); }));
|
|
68492
68660
|
};
|
|
68493
68661
|
var i = function () {
|
|
@@ -68505,11 +68673,44 @@ extendsClassMethod(RTCVideo, 'setVideoEncoderConfig', function (origin) {
|
|
|
68505
68673
|
}
|
|
68506
68674
|
};
|
|
68507
68675
|
});
|
|
68676
|
+
extendsClassMethod(RTCVideo, 'startPushSingleStreamToCDN', function () {
|
|
68677
|
+
return function impl(taskId, params) {
|
|
68678
|
+
var _this = this;
|
|
68679
|
+
var a = function () {
|
|
68680
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68681
|
+
var streamParams = new PushSingleStreamParam$1();
|
|
68682
|
+
streamParams.roomId = params.roomId;
|
|
68683
|
+
streamParams.userId = params.userId;
|
|
68684
|
+
streamParams.url = params.url;
|
|
68685
|
+
streamParams.isScreen = params.isScreen || false;
|
|
68686
|
+
return vertc.invokeStartPushSingleStreamToCDN(unpackObject(_this), taskId, streamParams);
|
|
68687
|
+
};
|
|
68688
|
+
var i = function () {
|
|
68689
|
+
var vertc = VertcHelper.getInstance();
|
|
68690
|
+
var streamParams = new ByteRTCPushSingleStreamParam();
|
|
68691
|
+
streamParams.roomId = params.roomId;
|
|
68692
|
+
streamParams.userId = params.userId;
|
|
68693
|
+
streamParams.url = params.url;
|
|
68694
|
+
streamParams.isScreen = params.isScreen || false;
|
|
68695
|
+
return vertc.invokeStartPushSingleStreamToCDN(unpackObject(_this), taskId, streamParams);
|
|
68696
|
+
};
|
|
68697
|
+
var $os = env.getOS();
|
|
68698
|
+
if ($os === 'android') {
|
|
68699
|
+
return a().then(Number);
|
|
68700
|
+
}
|
|
68701
|
+
else if ($os === 'ios') {
|
|
68702
|
+
return i().then(Number);
|
|
68703
|
+
}
|
|
68704
|
+
else {
|
|
68705
|
+
throw new Error('Not Support Platform ' + $os);
|
|
68706
|
+
}
|
|
68707
|
+
};
|
|
68708
|
+
});
|
|
68508
68709
|
extendsClassMethod(RTCVideo, 'setLocalVideoMirrorType', function (origin) {
|
|
68509
68710
|
return function impl(mirrorType) {
|
|
68510
68711
|
var _this = this;
|
|
68511
68712
|
var a = function () {
|
|
68512
|
-
var vertc = VertcHelper.getInstance();
|
|
68713
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68513
68714
|
return vertc.invokeSetLocalVideoMirrorType(unpackObject(_this), t_MirrorType.ts_to_android(mirrorType));
|
|
68514
68715
|
};
|
|
68515
68716
|
var i = function () {
|
|
@@ -69000,12 +69201,6 @@ var RTCManager = /** @class */ (function () {
|
|
|
69000
69201
|
});
|
|
69001
69202
|
return RTCVideo.setLogConfig(logConfig);
|
|
69002
69203
|
};
|
|
69003
|
-
/** {en}
|
|
69004
|
-
* @brief Set vod-player instance
|
|
69005
|
-
*/
|
|
69006
|
-
RTCManager.prototype.setVodPlayer = function (vodPlayer) {
|
|
69007
|
-
this.vodPlayer = vodPlayer;
|
|
69008
|
-
};
|
|
69009
69204
|
return RTCManager;
|
|
69010
69205
|
}());
|
|
69011
69206
|
|
package/lib/module/index.js
CHANGED
|
@@ -68199,7 +68199,83 @@ var VertcVod = function () {
|
|
|
68199
68199
|
return _classThis;
|
|
68200
68200
|
}();
|
|
68201
68201
|
|
|
68202
|
-
var
|
|
68202
|
+
var VertcLive$1 = function () {
|
|
68203
|
+
var _classDecorators = [NativeClass('com.volcengine.reactnative.vertc.live.VertcLive')];
|
|
68204
|
+
var _classDescriptor;
|
|
68205
|
+
var _classExtraInitializers = [];
|
|
68206
|
+
var _classThis;
|
|
68207
|
+
var _instanceExtraInitializers = [];
|
|
68208
|
+
var _startLiveVideoCapture_decorators;
|
|
68209
|
+
var _stopLiveVideoCapture_decorators;
|
|
68210
|
+
_classThis = /** @class */ (function () {
|
|
68211
|
+
function VertcLive_1() {
|
|
68212
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68213
|
+
}
|
|
68214
|
+
VertcLive_1.prototype.startLiveVideoCapture = function (video, viewId, options) {
|
|
68215
|
+
throw new Error('not implement');
|
|
68216
|
+
};
|
|
68217
|
+
VertcLive_1.prototype.stopLiveVideoCapture = function () {
|
|
68218
|
+
throw new Error('not implement');
|
|
68219
|
+
};
|
|
68220
|
+
return VertcLive_1;
|
|
68221
|
+
}());
|
|
68222
|
+
__setFunctionName(_classThis, "VertcLive");
|
|
68223
|
+
(function () {
|
|
68224
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68225
|
+
_startLiveVideoCapture_decorators = [NativeMethod()];
|
|
68226
|
+
_stopLiveVideoCapture_decorators = [NativeMethod()];
|
|
68227
|
+
__esDecorate(_classThis, null, _startLiveVideoCapture_decorators, { kind: "method", name: "startLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "startLiveVideoCapture" in obj; }, get: function (obj) { return obj.startLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68228
|
+
__esDecorate(_classThis, null, _stopLiveVideoCapture_decorators, { kind: "method", name: "stopLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "stopLiveVideoCapture" in obj; }, get: function (obj) { return obj.stopLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68229
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68230
|
+
_classThis = _classDescriptor.value;
|
|
68231
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68232
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68233
|
+
})();
|
|
68234
|
+
return _classThis;
|
|
68235
|
+
}();
|
|
68236
|
+
|
|
68237
|
+
var VertcLive = function () {
|
|
68238
|
+
var _classDecorators = [NativeClass('VertcLive')];
|
|
68239
|
+
var _classDescriptor;
|
|
68240
|
+
var _classExtraInitializers = [];
|
|
68241
|
+
var _classThis;
|
|
68242
|
+
var _instanceExtraInitializers = [];
|
|
68243
|
+
var _init_decorators;
|
|
68244
|
+
var _startLiveVideoCapture_decorators;
|
|
68245
|
+
var _stopLiveVideoCapture_decorators;
|
|
68246
|
+
_classThis = /** @class */ (function () {
|
|
68247
|
+
function VertcLive_1() {
|
|
68248
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68249
|
+
}
|
|
68250
|
+
VertcLive_1.prototype.init = function () {
|
|
68251
|
+
throw new Error('not implement');
|
|
68252
|
+
};
|
|
68253
|
+
VertcLive_1.prototype.startLiveVideoCapture = function (video, viewId, options) {
|
|
68254
|
+
throw new Error('not implement');
|
|
68255
|
+
};
|
|
68256
|
+
VertcLive_1.prototype.stopLiveVideoCapture = function () {
|
|
68257
|
+
throw new Error('not implement');
|
|
68258
|
+
};
|
|
68259
|
+
return VertcLive_1;
|
|
68260
|
+
}());
|
|
68261
|
+
__setFunctionName(_classThis, "VertcLive");
|
|
68262
|
+
(function () {
|
|
68263
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68264
|
+
_init_decorators = [NativeMethodSync('init')];
|
|
68265
|
+
_startLiveVideoCapture_decorators = [NativeMethod('startLiveVideoCapture:viewId:options:')];
|
|
68266
|
+
_stopLiveVideoCapture_decorators = [NativeMethod('stopLiveVideoCapture')];
|
|
68267
|
+
__esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68268
|
+
__esDecorate(_classThis, null, _startLiveVideoCapture_decorators, { kind: "method", name: "startLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "startLiveVideoCapture" in obj; }, get: function (obj) { return obj.startLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68269
|
+
__esDecorate(_classThis, null, _stopLiveVideoCapture_decorators, { kind: "method", name: "stopLiveVideoCapture", static: false, private: false, access: { has: function (obj) { return "stopLiveVideoCapture" in obj; }, get: function (obj) { return obj.stopLiveVideoCapture; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68270
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68271
|
+
_classThis = _classDescriptor.value;
|
|
68272
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68273
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68274
|
+
})();
|
|
68275
|
+
return _classThis;
|
|
68276
|
+
}();
|
|
68277
|
+
|
|
68278
|
+
var VertcHelper$1 = function () {
|
|
68203
68279
|
var _classDecorators = [NativeClass('com.volcengine.reactnative.vertc.VertcHelper')];
|
|
68204
68280
|
var _classDescriptor;
|
|
68205
68281
|
var _classExtraInitializers = [];
|
|
@@ -68210,6 +68286,7 @@ var VertcHelper = function () {
|
|
|
68210
68286
|
var _static_getInstance_decorators;
|
|
68211
68287
|
var _invokeSetVideoEncoderConfig_decorators;
|
|
68212
68288
|
var _invokeSetLocalVideoMirrorType_decorators;
|
|
68289
|
+
var _invokeStartPushSingleStreamToCDN_decorators;
|
|
68213
68290
|
var VertcHelper = _classThis = /** @class */ (function (_super) {
|
|
68214
68291
|
__extends(VertcHelper_1, _super);
|
|
68215
68292
|
function VertcHelper_1() {
|
|
@@ -68226,6 +68303,9 @@ var VertcHelper = function () {
|
|
|
68226
68303
|
VertcHelper_1.prototype.invokeSetLocalVideoMirrorType = function (video, mirrorType) {
|
|
68227
68304
|
throw new Error('not implement');
|
|
68228
68305
|
};
|
|
68306
|
+
VertcHelper_1.prototype.invokeStartPushSingleStreamToCDN = function (video, taskId, param) {
|
|
68307
|
+
throw new Error('not implement');
|
|
68308
|
+
};
|
|
68229
68309
|
return VertcHelper_1;
|
|
68230
68310
|
}(_classSuper));
|
|
68231
68311
|
__setFunctionName(_classThis, "VertcHelper");
|
|
@@ -68235,9 +68315,54 @@ var VertcHelper = function () {
|
|
|
68235
68315
|
_static_getInstance_decorators = [ReturnClass(function () { return VertcHelper; }), NativeStaticMethodSync()];
|
|
68236
68316
|
_invokeSetVideoEncoderConfig_decorators = [NativeMethod()];
|
|
68237
68317
|
_invokeSetLocalVideoMirrorType_decorators = [NativeMethod()];
|
|
68318
|
+
_invokeStartPushSingleStreamToCDN_decorators = [NativeMethod()];
|
|
68238
68319
|
__esDecorate(_classThis, null, _static_getInstance_decorators, { kind: "method", name: "getInstance", static: true, private: false, access: { has: function (obj) { return "getInstance" in obj; }, get: function (obj) { return obj.getInstance; } }, metadata: _metadata }, null, _staticExtraInitializers);
|
|
68239
68320
|
__esDecorate(_classThis, null, _invokeSetVideoEncoderConfig_decorators, { kind: "method", name: "invokeSetVideoEncoderConfig", static: false, private: false, access: { has: function (obj) { return "invokeSetVideoEncoderConfig" in obj; }, get: function (obj) { return obj.invokeSetVideoEncoderConfig; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68240
68321
|
__esDecorate(_classThis, null, _invokeSetLocalVideoMirrorType_decorators, { kind: "method", name: "invokeSetLocalVideoMirrorType", static: false, private: false, access: { has: function (obj) { return "invokeSetLocalVideoMirrorType" in obj; }, get: function (obj) { return obj.invokeSetLocalVideoMirrorType; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68322
|
+
__esDecorate(_classThis, null, _invokeStartPushSingleStreamToCDN_decorators, { kind: "method", name: "invokeStartPushSingleStreamToCDN", static: false, private: false, access: { has: function (obj) { return "invokeStartPushSingleStreamToCDN" in obj; }, get: function (obj) { return obj.invokeStartPushSingleStreamToCDN; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68323
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68324
|
+
VertcHelper = _classThis = _classDescriptor.value;
|
|
68325
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68326
|
+
__runInitializers(_classThis, _staticExtraInitializers);
|
|
68327
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
68328
|
+
})();
|
|
68329
|
+
return VertcHelper = _classThis;
|
|
68330
|
+
}();
|
|
68331
|
+
|
|
68332
|
+
var VertcHelper = function () {
|
|
68333
|
+
var _classDecorators = [NativeClass('VertcHelper')];
|
|
68334
|
+
var _classDescriptor;
|
|
68335
|
+
var _classExtraInitializers = [];
|
|
68336
|
+
var _classThis;
|
|
68337
|
+
var _staticExtraInitializers = [];
|
|
68338
|
+
var _instanceExtraInitializers = [];
|
|
68339
|
+
var _static_getInstance_decorators;
|
|
68340
|
+
var _init_decorators;
|
|
68341
|
+
var _invokeStartPushSingleStreamToCDN_decorators;
|
|
68342
|
+
var VertcHelper = _classThis = /** @class */ (function () {
|
|
68343
|
+
function VertcHelper_1() {
|
|
68344
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
68345
|
+
}
|
|
68346
|
+
VertcHelper_1.prototype.init = function () {
|
|
68347
|
+
throw new Error('not implement');
|
|
68348
|
+
};
|
|
68349
|
+
VertcHelper_1.getInstance = function () {
|
|
68350
|
+
throw new Error('not implement');
|
|
68351
|
+
};
|
|
68352
|
+
VertcHelper_1.prototype.invokeStartPushSingleStreamToCDN = function (video, taskId, param) {
|
|
68353
|
+
throw new Error('not implement');
|
|
68354
|
+
};
|
|
68355
|
+
return VertcHelper_1;
|
|
68356
|
+
}());
|
|
68357
|
+
__setFunctionName(_classThis, "VertcHelper");
|
|
68358
|
+
(function () {
|
|
68359
|
+
var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
68360
|
+
_init_decorators = [NativeMethodSync('init')];
|
|
68361
|
+
_static_getInstance_decorators = [ReturnClass(function () { return VertcHelper; }), NativeStaticMethodSync('getInstance')];
|
|
68362
|
+
_invokeStartPushSingleStreamToCDN_decorators = [NativeMethod('invokeStartPushSingleStreamToCDN:taskId:singleStream:')];
|
|
68363
|
+
__esDecorate(_classThis, null, _static_getInstance_decorators, { kind: "method", name: "getInstance", static: true, private: false, access: { has: function (obj) { return "getInstance" in obj; }, get: function (obj) { return obj.getInstance; } }, metadata: _metadata }, null, _staticExtraInitializers);
|
|
68364
|
+
__esDecorate(_classThis, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: function (obj) { return "init" in obj; }, get: function (obj) { return obj.init; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68365
|
+
__esDecorate(_classThis, null, _invokeStartPushSingleStreamToCDN_decorators, { kind: "method", name: "invokeStartPushSingleStreamToCDN", static: false, private: false, access: { has: function (obj) { return "invokeStartPushSingleStreamToCDN" in obj; }, get: function (obj) { return obj.invokeStartPushSingleStreamToCDN; } }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68241
68366
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
68242
68367
|
VertcHelper = _classThis = _classDescriptor.value;
|
|
68243
68368
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -68305,15 +68430,17 @@ extendsClassMember(RemoteVideoStats, 'codecType')(function () {
|
|
|
68305
68430
|
});
|
|
68306
68431
|
extendsClassMethod(android_RTCRoomEventHandler, 'onStreamRemove', function () {
|
|
68307
68432
|
return function impl(stream, reason) {
|
|
68433
|
+
var _a, _b;
|
|
68308
68434
|
if (this._instance.onStreamRemove) {
|
|
68309
|
-
this._instance.onStreamRemove(packObject(stream, RTCStream), t_StreamRemoveReason.android_to_ts(reason));
|
|
68435
|
+
(_b = (_a = this._instance).onStreamRemove) === null || _b === void 0 ? void 0 : _b.call(_a, packObject(stream, RTCStream), t_StreamRemoveReason.android_to_ts(reason));
|
|
68310
68436
|
}
|
|
68311
68437
|
};
|
|
68312
68438
|
});
|
|
68313
68439
|
extendsClassMethod(ios_RTCRoomEventHandler, 'rtcRoom$onStreamRemove$stream$reason', function () {
|
|
68314
68440
|
return function impl(rtcRoom, uid, stream, reason) {
|
|
68441
|
+
var _a, _b;
|
|
68315
68442
|
if (this._instance.onStreamRemove) {
|
|
68316
|
-
this._instance.onStreamRemove(packObject(stream, RTCStream), t_StreamRemoveReason.ios_to_ts(reason));
|
|
68443
|
+
(_b = (_a = this._instance).onStreamRemove) === null || _b === void 0 ? void 0 : _b.call(_a, packObject(stream, RTCStream), t_StreamRemoveReason.ios_to_ts(reason));
|
|
68317
68444
|
}
|
|
68318
68445
|
};
|
|
68319
68446
|
});
|
|
@@ -68481,11 +68608,52 @@ extendsClassMethod(RTCVideo, 'stopVodPlayerCapture', function () {
|
|
|
68481
68608
|
}
|
|
68482
68609
|
};
|
|
68483
68610
|
});
|
|
68611
|
+
var LiveHelperKey = '_live';
|
|
68612
|
+
extendsClassMethod(RTCVideo, 'startLiveVideoCapture', function () {
|
|
68613
|
+
return function impl(viewId, options) {
|
|
68614
|
+
var _this = this;
|
|
68615
|
+
if (options === void 0) { options = {}; }
|
|
68616
|
+
if (!viewId) {
|
|
68617
|
+
throw new Error('Live player view id is required.');
|
|
68618
|
+
}
|
|
68619
|
+
var a = function () {
|
|
68620
|
+
var androidRtc = unpackObject(_this);
|
|
68621
|
+
var ins = new VertcLive$1();
|
|
68622
|
+
_this[LiveHelperKey] = ins;
|
|
68623
|
+
return ins.startLiveVideoCapture(androidRtc, viewId, options);
|
|
68624
|
+
};
|
|
68625
|
+
var i = function () {
|
|
68626
|
+
var iosRtc = unpackObject(_this);
|
|
68627
|
+
var ins = new VertcLive();
|
|
68628
|
+
_this[LiveHelperKey] = ins;
|
|
68629
|
+
return ins.startLiveVideoCapture(iosRtc, viewId, options);
|
|
68630
|
+
};
|
|
68631
|
+
var $os = env.getOS();
|
|
68632
|
+
if ($os === 'android') {
|
|
68633
|
+
return a();
|
|
68634
|
+
}
|
|
68635
|
+
else if ($os === 'ios') {
|
|
68636
|
+
return i();
|
|
68637
|
+
}
|
|
68638
|
+
else {
|
|
68639
|
+
throw new Error('Not Support Platform ' + $os);
|
|
68640
|
+
}
|
|
68641
|
+
};
|
|
68642
|
+
});
|
|
68643
|
+
extendsClassMethod(RTCVideo, 'stopLiveVideoCapture', function () {
|
|
68644
|
+
return function impl() {
|
|
68645
|
+
var ins = this[LiveHelperKey];
|
|
68646
|
+
if (!ins) {
|
|
68647
|
+
return -2;
|
|
68648
|
+
}
|
|
68649
|
+
return ins.stopLiveVideoCapture();
|
|
68650
|
+
};
|
|
68651
|
+
});
|
|
68484
68652
|
extendsClassMethod(RTCVideo, 'setVideoEncoderConfig', function (origin) {
|
|
68485
68653
|
return function impl(channelSolutions) {
|
|
68486
68654
|
var _this = this;
|
|
68487
68655
|
var a = function () {
|
|
68488
|
-
var vertc = VertcHelper.getInstance();
|
|
68656
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68489
68657
|
return vertc.invokeSetVideoEncoderConfig(unpackObject(_this), channelSolutions.map(function (item) { return unpackObject(item); }));
|
|
68490
68658
|
};
|
|
68491
68659
|
var i = function () {
|
|
@@ -68503,11 +68671,44 @@ extendsClassMethod(RTCVideo, 'setVideoEncoderConfig', function (origin) {
|
|
|
68503
68671
|
}
|
|
68504
68672
|
};
|
|
68505
68673
|
});
|
|
68674
|
+
extendsClassMethod(RTCVideo, 'startPushSingleStreamToCDN', function () {
|
|
68675
|
+
return function impl(taskId, params) {
|
|
68676
|
+
var _this = this;
|
|
68677
|
+
var a = function () {
|
|
68678
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68679
|
+
var streamParams = new PushSingleStreamParam$1();
|
|
68680
|
+
streamParams.roomId = params.roomId;
|
|
68681
|
+
streamParams.userId = params.userId;
|
|
68682
|
+
streamParams.url = params.url;
|
|
68683
|
+
streamParams.isScreen = params.isScreen || false;
|
|
68684
|
+
return vertc.invokeStartPushSingleStreamToCDN(unpackObject(_this), taskId, streamParams);
|
|
68685
|
+
};
|
|
68686
|
+
var i = function () {
|
|
68687
|
+
var vertc = VertcHelper.getInstance();
|
|
68688
|
+
var streamParams = new ByteRTCPushSingleStreamParam();
|
|
68689
|
+
streamParams.roomId = params.roomId;
|
|
68690
|
+
streamParams.userId = params.userId;
|
|
68691
|
+
streamParams.url = params.url;
|
|
68692
|
+
streamParams.isScreen = params.isScreen || false;
|
|
68693
|
+
return vertc.invokeStartPushSingleStreamToCDN(unpackObject(_this), taskId, streamParams);
|
|
68694
|
+
};
|
|
68695
|
+
var $os = env.getOS();
|
|
68696
|
+
if ($os === 'android') {
|
|
68697
|
+
return a().then(Number);
|
|
68698
|
+
}
|
|
68699
|
+
else if ($os === 'ios') {
|
|
68700
|
+
return i().then(Number);
|
|
68701
|
+
}
|
|
68702
|
+
else {
|
|
68703
|
+
throw new Error('Not Support Platform ' + $os);
|
|
68704
|
+
}
|
|
68705
|
+
};
|
|
68706
|
+
});
|
|
68506
68707
|
extendsClassMethod(RTCVideo, 'setLocalVideoMirrorType', function (origin) {
|
|
68507
68708
|
return function impl(mirrorType) {
|
|
68508
68709
|
var _this = this;
|
|
68509
68710
|
var a = function () {
|
|
68510
|
-
var vertc = VertcHelper.getInstance();
|
|
68711
|
+
var vertc = VertcHelper$1.getInstance();
|
|
68511
68712
|
return vertc.invokeSetLocalVideoMirrorType(unpackObject(_this), t_MirrorType.ts_to_android(mirrorType));
|
|
68512
68713
|
};
|
|
68513
68714
|
var i = function () {
|
|
@@ -68998,12 +69199,6 @@ var RTCManager = /** @class */ (function () {
|
|
|
68998
69199
|
});
|
|
68999
69200
|
return RTCVideo.setLogConfig(logConfig);
|
|
69000
69201
|
};
|
|
69001
|
-
/** {en}
|
|
69002
|
-
* @brief Set vod-player instance
|
|
69003
|
-
*/
|
|
69004
|
-
RTCManager.prototype.setVodPlayer = function (vodPlayer) {
|
|
69005
|
-
this.vodPlayer = vodPlayer;
|
|
69006
|
-
};
|
|
69007
69202
|
return RTCManager;
|
|
69008
69203
|
}());
|
|
69009
69204
|
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
import { RTCStream, type StreamRemoveReason } from '../codegen/pack';
|
|
5
5
|
declare module '../codegen/pack/index.ts' {
|
|
6
6
|
interface RTCRoomEventHandler {
|
|
7
|
-
onStreamRemove(stream: RTCStream, reason: StreamRemoveReason): void;
|
|
7
|
+
onStreamRemove?(stream: RTCStream, reason: StreamRemoveReason): void;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import { RTCVideo, type ProblemFeedbackOption } from '../codegen/pack';
|
|
4
|
+
import { RTCVideo, type ProblemFeedbackOption, StreamIndex } from '../codegen/pack';
|
|
5
5
|
import type { IFeedbackProblemInfo, IRemoteStreamInfo } from '../interface';
|
|
6
6
|
import './callback';
|
|
7
7
|
declare module '../codegen/pack' {
|
|
@@ -11,12 +11,44 @@ declare module '../codegen/pack' {
|
|
|
11
11
|
*/
|
|
12
12
|
fps?: number;
|
|
13
13
|
}
|
|
14
|
+
interface ILiveCaptureOptions {
|
|
15
|
+
/**
|
|
16
|
+
* video streamIndex
|
|
17
|
+
*/
|
|
18
|
+
streamIndex?: StreamIndex;
|
|
19
|
+
}
|
|
14
20
|
interface RTCVideo {
|
|
15
21
|
feedback(options: ProblemFeedbackOption[], info: IFeedbackProblemInfo): number;
|
|
16
22
|
setRuntimeParameters(params: Record<string, string>): number;
|
|
17
23
|
setRemoteAudioPlaybackVolume(config: IRemoteStreamInfo, volume: number): void;
|
|
24
|
+
/** {en}
|
|
25
|
+
* @brief Start to observe vod player, capture frames from vod player and set stream for external screen stream.
|
|
26
|
+
* @param player The player instance call by `initPlayer` from `react-native-vod-player` SDK.
|
|
27
|
+
* @return
|
|
28
|
+
* - 0: Success.
|
|
29
|
+
* - <0: Failed.
|
|
30
|
+
*/
|
|
18
31
|
startVodPlayerCapture(player: any, options?: IVodPlayerCaptureOptions): Promise<void>;
|
|
32
|
+
/** {en}
|
|
33
|
+
* @brief Stop all vod player observer in rtc.
|
|
34
|
+
* @note Once you invoke this api, you should invoke `startVodPlayerCapture` to observe vod player.
|
|
35
|
+
*/
|
|
19
36
|
stopVodPlayerCapture(player: any): Promise<void>;
|
|
37
|
+
/** {en}
|
|
38
|
+
* @brief Start to observe live player, capture frames from live player and set stream for external stream.
|
|
39
|
+
* @param viewId The live player view id.
|
|
40
|
+
* @param options ILiveCaptureOptions, Support publish by main stream(default) or screen stream.
|
|
41
|
+
* @note When pushing through screen streaming, Android has a 5fps limit. If you need to lift the limit, please contact us to handle it for you, or give priority to using camera streaming.
|
|
42
|
+
* @return
|
|
43
|
+
* - 0: Success.
|
|
44
|
+
* - <0: Failed.
|
|
45
|
+
*/
|
|
46
|
+
startLiveVideoCapture(viewId: string, options?: ILiveCaptureOptions): Promise<number>;
|
|
47
|
+
/** {en}
|
|
48
|
+
* @brief Stop all vod player observer in rtc.
|
|
49
|
+
* @note Once you invoke this api, you should invoke `startLiveVideoCapture` to observe live player.
|
|
50
|
+
*/
|
|
51
|
+
stopLiveVideoCapture(): Promise<number>;
|
|
20
52
|
}
|
|
21
53
|
}
|
|
22
54
|
export { RTCVideo };
|
package/lib/typescript/core.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { RTCVideo } from './core/rtc-video';
|
|
|
7
7
|
* @detail api
|
|
8
8
|
* @brief An engine class encapsulated by the {@link RTCVideo RTCVideo} class of the Android/iOS SDK.
|
|
9
9
|
*/
|
|
10
|
-
export type IEngine = Omit<RTCVideo, 'setLocalVideoCanvas' | 'createRTCRoom' | 'setCellularEnhancement' | 'enableAudioPropertiesReport' | 'setRemoteAudioPlaybackVolume' | 'getAudioEffectPlayer' | 'getMediaPlayer' | 'setScreenVideoEncoderConfig' | 'startScreenCapture' | 'setRemoteVideoCanvas' | 'requestRemoteVideoKeyFrame' | 'sendStreamSyncInfo' | 'setVideoEncodeConfig'> & {
|
|
10
|
+
export type IEngine = Omit<RTCVideo, 'setLocalVideoCanvas' | 'createRTCRoom' | 'setCellularEnhancement' | 'enableAudioPropertiesReport' | 'setRemoteAudioPlaybackVolume' | 'getAudioEffectPlayer' | 'getMediaPlayer' | 'setScreenVideoEncoderConfig' | 'startScreenCapture' | 'setRemoteVideoCanvas' | 'requestRemoteVideoKeyFrame' | 'sendStreamSyncInfo' | 'setVideoEncodeConfig' | 'startPushSingleStreamToCDN'> & {
|
|
11
11
|
/** {en}
|
|
12
12
|
* @brief Sets the view to be used for local video rendering and the rendering mode.
|
|
13
13
|
* @param streamIndex Video stream type.
|
|
@@ -170,6 +170,35 @@ export type IEngine = Omit<RTCVideo, 'setLocalVideoCanvas' | 'createRTCRoom' | '
|
|
|
170
170
|
* - This API is applicable to the video stream captured by the camera, see {@link setScreenVideoEncoderConfig setScreenVideoEncoderConfig} for setting parameters for screen sharing video stream.
|
|
171
171
|
*/
|
|
172
172
|
setVideoEncoderConfig(channelSolutions: IVideoEncoderConfig[]): number;
|
|
173
|
+
/** {en}
|
|
174
|
+
* @brief Start to observe vod player, capture frames from vod player and set stream for external screen stream.
|
|
175
|
+
* @param player The player instance call by `initPlayer` from `react-native-vod-player` SDK.
|
|
176
|
+
* @return
|
|
177
|
+
* - 0: Success.
|
|
178
|
+
* - <0: Failed.
|
|
179
|
+
*/
|
|
180
|
+
startVodPlayerCapture(player: any): number;
|
|
181
|
+
/** {en}
|
|
182
|
+
* @brief Stop all vod player observer in rtc.
|
|
183
|
+
* @note Once you invoke this api, you should invoke `startVodPlayerCapture` to observe vod player.
|
|
184
|
+
*/
|
|
185
|
+
stopVodPlayerCapture(player: any): number;
|
|
186
|
+
/** {en}
|
|
187
|
+
* @detail api
|
|
188
|
+
* @region Push to CDN
|
|
189
|
+
* @brief Create a new task of pushing a single media stream to CDN.
|
|
190
|
+
* @param taskId Task ID.
|
|
191
|
+
* You may want to start more than one task to push streams to CDN. When you do that, use different IDs for corresponding tasks; if you will start only one task, use an empty string.
|
|
192
|
+
* @param param Configurations for pushing a single stream to CDN. See IPushSingleStreamParam。.
|
|
193
|
+
* @return
|
|
194
|
+
* - 0: Success.
|
|
195
|
+
* - < 0 : Fail. See {@link ReturnStatus ReturnStatus} for more details
|
|
196
|
+
* @note
|
|
197
|
+
* - Before calling this API,you need to enable Push to CDN on the [console](https://console.byteplus.com/rtc/workplaceRTC).
|
|
198
|
+
* - Call {@link stopPushStreamToCDN stopPushStreamToCDN} to stop the task.
|
|
199
|
+
* - Since this API does not perform encoding and decoding, the video stream pushed to RTMP will change according to the resolution, encoding method, and turning off the camera of the end of pushing streams.
|
|
200
|
+
*/
|
|
201
|
+
startPushSingleStreamToCDN(taskId: string, params: IPushSingleStreamParam): number;
|
|
173
202
|
};
|
|
174
203
|
/** {en}
|
|
175
204
|
* @detail api
|
|
@@ -645,6 +674,29 @@ export interface IForwardStreamConfig {
|
|
|
645
674
|
*/
|
|
646
675
|
token: string;
|
|
647
676
|
}
|
|
677
|
+
/** {en}
|
|
678
|
+
* @detail keytype
|
|
679
|
+
* @brief Params for stream push to cdn.
|
|
680
|
+
*/
|
|
681
|
+
export interface IPushSingleStreamParam {
|
|
682
|
+
/** {en}
|
|
683
|
+
* @brief The room ID of the media stream
|
|
684
|
+
*/
|
|
685
|
+
roomId: string;
|
|
686
|
+
/** {en}
|
|
687
|
+
* @brief The user ID of the media stream
|
|
688
|
+
*/
|
|
689
|
+
userId: string;
|
|
690
|
+
/** {en}
|
|
691
|
+
* @brief The URL for live transcoding. Only supports live transcoding via RTMP. The URL should match the regular expression `/^rtmps?:\\/\\//`. <br>
|
|
692
|
+
* This parameter cannot be updated while pushing stream to the CDN.
|
|
693
|
+
*/
|
|
694
|
+
url: string;
|
|
695
|
+
/** {en}
|
|
696
|
+
* @brief Whether the media stream is a screen-sharing stream.
|
|
697
|
+
*/
|
|
698
|
+
isScreen?: boolean;
|
|
699
|
+
}
|
|
648
700
|
/** {en}
|
|
649
701
|
* @detail keytype
|
|
650
702
|
* @brief Local log parameters.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { RTCVideo } from '../../codegen/android';
|
|
5
|
+
export declare class VertcLive {
|
|
6
|
+
startLiveVideoCapture(video: RTCVideo, viewId: string, options: Record<string, any>): Promise<number>;
|
|
7
|
+
stopLiveVideoCapture(): Promise<number>;
|
|
8
|
+
}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import { NativeProxyService } from '@vcloud-lux/hybrid-runtime';
|
|
5
5
|
import { MirrorType, RTCVideo, VideoEncoderConfig } from '../../codegen/android';
|
|
6
|
+
import { IPushSingleStreamParam } from '../../interface';
|
|
6
7
|
export declare class VertcHelper extends NativeProxyService {
|
|
7
8
|
static getInstance(): VertcHelper;
|
|
8
9
|
invokeSetVideoEncoderConfig(video: RTCVideo, channelSolutions: VideoEncoderConfig[]): Promise<number>;
|
|
9
10
|
invokeSetLocalVideoMirrorType(video: RTCVideo, mirrorType: MirrorType): Promise<number>;
|
|
11
|
+
invokeStartPushSingleStreamToCDN(video: RTCVideo, taskId: string, param: IPushSingleStreamParam): Promise<number>;
|
|
10
12
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { ByteRTCVideo } from '../../codegen/ios';
|
|
5
|
+
export declare class VertcLive {
|
|
6
|
+
init(): this;
|
|
7
|
+
startLiveVideoCapture(video: ByteRTCVideo, viewId: string, options: Record<string, any>): Promise<void>;
|
|
8
|
+
stopLiveVideoCapture(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright © 2022 BytePlusRTC All rights reserved.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import { ByteRTCVideo } from '../../codegen/ios';
|
|
5
|
+
import { IPushSingleStreamParam } from '../../interface';
|
|
6
|
+
export declare class VertcHelper {
|
|
7
|
+
init(): this;
|
|
8
|
+
static getInstance(): VertcHelper;
|
|
9
|
+
invokeStartPushSingleStreamToCDN(video: ByteRTCVideo, taskId: string, param: IPushSingleStreamParam): Promise<number>;
|
|
10
|
+
}
|
package/package.json
CHANGED
package/react-native-rtc.podspec
CHANGED
|
@@ -67,8 +67,11 @@ Pod::Spec.new do |s|
|
|
|
67
67
|
rtc_version_byteplus_non_union = '3.58.1.14800'
|
|
68
68
|
rtc_version = enable_union ? rtc_version_byteplus_union : rtc_version_byteplus_non_union
|
|
69
69
|
if enable_union
|
|
70
|
-
s.dependency 'TTSDKFramework/RTCSDK', '1.46.300.
|
|
71
|
-
s.dependency 'TTSDKFramework/Player-SR', '1.46.300.
|
|
70
|
+
s.dependency 'TTSDKFramework/RTCSDK', '1.46.300.3-premium'
|
|
71
|
+
s.dependency 'TTSDKFramework/Player-SR', '1.46.300.3-premium'
|
|
72
|
+
s.dependency 'TTSDKFramework/Core', '1.46.300.3-premium'
|
|
73
|
+
s.dependency 'TTSDKFramework/LivePush-RTS', '1.46.300.3-premium'
|
|
74
|
+
s.dependency 'react-native-velive-push'
|
|
72
75
|
else
|
|
73
76
|
s.dependency 'BytePlusRTC', rtc_version
|
|
74
77
|
s.dependency 'TTSDKFramework/Player-SR', '1.45.300.3-premium'
|