trtc-electron-sdk 10.7.405-beta.0 → 10.7.405
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/liteav/Render/util.d.ts +1 -2
- package/liteav/Render/util.js +1 -1
- package/liteav/Renderer/Canvas2DRenderer/index.js +6 -2
- package/liteav/Renderer/Canvas3DRenderer/index.js +6 -2
- package/liteav/Renderer/types.d.ts +2 -2
- package/liteav/Renderer/util.d.ts +3 -2
- package/liteav/Renderer/util.js +10 -6
- package/liteav/trtc.d.ts +1 -1
- package/liteav/trtc.js +149 -121
- package/liteav/trtc_define.d.ts +10 -1
- package/liteav/trtc_define.js +26 -1
- package/package.json +1 -1
package/liteav/Render/util.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { TRTCVideoStreamType } from "../trtc_define";
|
|
3
2
|
/**
|
|
4
3
|
* 配置对象, 可用来打开 debug 模式
|
|
5
4
|
*
|
|
@@ -43,5 +42,5 @@ export declare function calcVideoStyle(options?: {
|
|
|
43
42
|
[x: string]: any;
|
|
44
43
|
};
|
|
45
44
|
export declare const config: Config;
|
|
46
|
-
export declare function allocBuffer(length: number
|
|
45
|
+
export declare function allocBuffer(length: number): Buffer;
|
|
47
46
|
export declare function generateUniqueId(): number;
|
package/liteav/Render/util.js
CHANGED
|
@@ -127,7 +127,7 @@ function calcVideoStyle(options = {
|
|
|
127
127
|
}
|
|
128
128
|
exports.calcVideoStyle = calcVideoStyle;
|
|
129
129
|
exports.config = new Config();
|
|
130
|
-
function allocBuffer(length
|
|
130
|
+
function allocBuffer(length) {
|
|
131
131
|
if (length >= 1) {
|
|
132
132
|
return Buffer.alloc(length);
|
|
133
133
|
}
|
|
@@ -157,10 +157,14 @@ class Canvas2dRenderer {
|
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
this.cacheCanvasOptions = Object.assign({}, options);
|
|
160
|
-
const { width, height, transform } = (0, util_1.calcCanvasStyle)(options);
|
|
160
|
+
const { width, height, zoom, transform } = (0, util_1.calcCanvasStyle)(options);
|
|
161
161
|
this.canvas.width = width;
|
|
162
162
|
this.canvas.height = height;
|
|
163
|
-
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
this.canvas.style.zoom = zoom;
|
|
165
|
+
if (transform) {
|
|
166
|
+
this.canvas.style.transform = transform;
|
|
167
|
+
}
|
|
164
168
|
}
|
|
165
169
|
else {
|
|
166
170
|
throw new Error('canvas element not exist');
|
|
@@ -181,10 +181,14 @@ class Canvas3dRenderer {
|
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
this.cacheCanvasOptions = Object.assign({}, options);
|
|
184
|
-
const { width, height, transform } = (0, util_1.calcCanvasStyle)(options);
|
|
184
|
+
const { width, height, zoom, transform } = (0, util_1.calcCanvasStyle)(options);
|
|
185
185
|
this.canvas.width = width;
|
|
186
186
|
this.canvas.height = height;
|
|
187
|
-
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
this.canvas.style.zoom = zoom;
|
|
189
|
+
if (transform) {
|
|
190
|
+
this.canvas.style.transform = transform;
|
|
191
|
+
}
|
|
188
192
|
}
|
|
189
193
|
else {
|
|
190
194
|
throw new Error('canvas element not exist');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TRTCVideoFillMode } from "../trtc_define";
|
|
2
|
-
export
|
|
2
|
+
export type TFrameData = {
|
|
3
3
|
data: Uint8Array | ArrayBuffer;
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
@@ -7,7 +7,7 @@ export declare type TFrameData = {
|
|
|
7
7
|
rotation: number;
|
|
8
8
|
isNeedRotate: boolean;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type TCanvasImageSourceStyleOptions = {
|
|
11
11
|
contentWidth: number;
|
|
12
12
|
contentHeight: number;
|
|
13
13
|
containerWidth: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
2
|
/**
|
|
3
3
|
* 配置对象, 可用来打开 debug 模式
|
|
4
4
|
*
|
|
@@ -42,7 +42,8 @@ export declare function calcVideoStyle(options?: {
|
|
|
42
42
|
[x: string]: any;
|
|
43
43
|
};
|
|
44
44
|
export declare const config: Config;
|
|
45
|
-
export declare function allocBuffer(length: number
|
|
45
|
+
export declare function allocBuffer(length: number): Buffer | null;
|
|
46
|
+
export declare function generateUniqueId(): number;
|
|
46
47
|
export declare function transferBGRA2RGBA(data: Uint8Array | ArrayBuffer, width: number, height: number): Uint8Array | ArrayBuffer;
|
|
47
48
|
/**
|
|
48
49
|
* 判断是否支持webGL
|
package/liteav/Renderer/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSupportWebGL = exports.transferBGRA2RGBA = exports.allocBuffer = exports.config = exports.calcVideoStyle = exports.calcCanvasStyle = exports.calcScaleRate = exports.isNeedKeepWidthAndHeight = exports.Config = void 0;
|
|
3
|
+
exports.isSupportWebGL = exports.transferBGRA2RGBA = exports.generateUniqueId = exports.allocBuffer = exports.config = exports.calcVideoStyle = exports.calcCanvasStyle = exports.calcScaleRate = exports.isNeedKeepWidthAndHeight = exports.Config = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 配置对象, 可用来打开 debug 模式
|
|
6
6
|
*
|
|
@@ -72,7 +72,8 @@ function calcCanvasStyle(options = {
|
|
|
72
72
|
const style = {
|
|
73
73
|
width: 0,
|
|
74
74
|
height: 0,
|
|
75
|
-
transform: ''
|
|
75
|
+
transform: '',
|
|
76
|
+
zoom: 1
|
|
76
77
|
};
|
|
77
78
|
const isKeepWidthHeight = isNeedKeepWidthAndHeight(options.rotation, options.isNeedRotate);
|
|
78
79
|
if (isKeepWidthHeight) {
|
|
@@ -84,9 +85,9 @@ function calcCanvasStyle(options = {
|
|
|
84
85
|
style.width = options.contentHeight;
|
|
85
86
|
}
|
|
86
87
|
const scale = calcScaleRate(!isKeepWidthHeight, options.contentMode, style.width, style.height, options.containerWidth, options.containerHeight);
|
|
87
|
-
style.
|
|
88
|
+
style.zoom = scale;
|
|
88
89
|
if (options.isNeedMirror) {
|
|
89
|
-
style.transform =
|
|
90
|
+
style.transform = `rotateY(180deg)`;
|
|
90
91
|
}
|
|
91
92
|
return style;
|
|
92
93
|
}
|
|
@@ -127,14 +128,17 @@ function calcVideoStyle(options = {
|
|
|
127
128
|
}
|
|
128
129
|
exports.calcVideoStyle = calcVideoStyle;
|
|
129
130
|
exports.config = new Config();
|
|
130
|
-
function allocBuffer(length
|
|
131
|
-
console.debug('trtc:alloc buffer:', length, userId, streamType);
|
|
131
|
+
function allocBuffer(length) {
|
|
132
132
|
if (length >= 1) {
|
|
133
133
|
return Buffer.alloc(length);
|
|
134
134
|
}
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
137
|
exports.allocBuffer = allocBuffer;
|
|
138
|
+
function generateUniqueId() {
|
|
139
|
+
return Date.now() * 1000 + Math.floor(Math.random() * 1000);
|
|
140
|
+
}
|
|
141
|
+
exports.generateUniqueId = generateUniqueId;
|
|
138
142
|
function transferBGRA2RGBA(data, width, height) {
|
|
139
143
|
const bgraData = new Uint8ClampedArray((data.buffer || data).slice(0));
|
|
140
144
|
const rgbaData = new Uint8ClampedArray((data.buffer || data).slice(0));
|
package/liteav/trtc.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
69
69
|
*
|
|
70
70
|
* @returns {TRTCConfig}
|
|
71
71
|
*/
|
|
72
|
-
getConfigObject(): import("./
|
|
72
|
+
getConfigObject(): import("./Renderer/util").Config;
|
|
73
73
|
setExternalRenderEnabled(enabled: boolean): void;
|
|
74
74
|
/**
|
|
75
75
|
* 清理资源
|
package/liteav/trtc.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
const events_1 = require("events");
|
|
21
21
|
const Renderer_1 = require("./Renderer");
|
|
22
|
-
const util_1 = require("./
|
|
22
|
+
const util_1 = require("./Renderer/util");
|
|
23
23
|
const yuv_buffer_1 = __importDefault(require("./Renderer/yuv-buffer"));
|
|
24
24
|
const vod_player_1 = require("./vod_player");
|
|
25
25
|
// @ts-ignore
|
|
@@ -36,36 +36,12 @@ const CAMERA_DEVICE_TEST_VIEW = 'camera_device_test_view';
|
|
|
36
36
|
const CAMERA_DEVICE_TEST_ID = 'camera_device_test';
|
|
37
37
|
const DEFAULT_VIDEO_WIDTH = 640;
|
|
38
38
|
const DEFAULT_VIDEO_HEIGHT = 360;
|
|
39
|
-
const localVideoBuffer = {
|
|
40
|
-
id: 0,
|
|
41
|
-
userId: '',
|
|
42
|
-
buffer: null,
|
|
43
|
-
streamType: trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
|
|
44
|
-
width: DEFAULT_VIDEO_WIDTH,
|
|
45
|
-
height: DEFAULT_VIDEO_HEIGHT,
|
|
46
|
-
pixelFormat: trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420,
|
|
47
|
-
};
|
|
48
|
-
const screenVideoBuffer = {
|
|
49
|
-
id: 0,
|
|
50
|
-
userId: '',
|
|
51
|
-
buffer: null,
|
|
52
|
-
streamType: trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
53
|
-
width: DEFAULT_VIDEO_WIDTH,
|
|
54
|
-
height: DEFAULT_VIDEO_HEIGHT,
|
|
55
|
-
pixelFormat: trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420,
|
|
56
|
-
};
|
|
57
|
-
const cameraTestVideoBuffer = {
|
|
58
|
-
id: 0,
|
|
59
|
-
userId: CAMERA_DEVICE_TEST_ID,
|
|
60
|
-
buffer: null,
|
|
61
|
-
streamType: trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
|
|
62
|
-
width: DEFAULT_VIDEO_WIDTH,
|
|
63
|
-
height: DEFAULT_VIDEO_HEIGHT,
|
|
64
|
-
pixelFormat: trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420,
|
|
65
|
-
};
|
|
66
|
-
const remoteVideoBufferMap = new Map();
|
|
67
39
|
const SDK_LOG_LEVEL = 2;
|
|
68
|
-
|
|
40
|
+
const localVideoBuffer = new trtc_define_1.VideoBufferInfo();
|
|
41
|
+
const screenVideoBufferMap = new Map();
|
|
42
|
+
const cameraTestVideoBuffer = new trtc_define_1.VideoBufferInfo();
|
|
43
|
+
const remoteVideoBufferMap = new Map();
|
|
44
|
+
const genSecFunc = function (instance, key) {
|
|
69
45
|
return function () {
|
|
70
46
|
let param = Array.from(arguments);
|
|
71
47
|
let result = undefined;
|
|
@@ -79,7 +55,7 @@ let genSecFunc = function (instance, key) {
|
|
|
79
55
|
}
|
|
80
56
|
};
|
|
81
57
|
};
|
|
82
|
-
|
|
58
|
+
const copyMethods = function (instance) {
|
|
83
59
|
for (let key in instance) {
|
|
84
60
|
if (typeof instance[key] != 'function' || key === 'constructor' || key.slice(0, 1) === '_' || typeof instance[key] != 'undefined') {
|
|
85
61
|
continue;
|
|
@@ -88,7 +64,7 @@ let copyMethods = function (instance) {
|
|
|
88
64
|
}
|
|
89
65
|
};
|
|
90
66
|
let copyPropMethods = function (instance) {
|
|
91
|
-
|
|
67
|
+
const disList = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(instance));
|
|
92
68
|
for (let key in disList) {
|
|
93
69
|
if (typeof instance[key] != 'function' || key === 'constructor' || key.slice(0, 1) === '_' || typeof instance[key] != 'undefined') {
|
|
94
70
|
continue;
|
|
@@ -96,13 +72,13 @@ let copyPropMethods = function (instance) {
|
|
|
96
72
|
instance[key] = genSecFunc(key, instance);
|
|
97
73
|
}
|
|
98
74
|
};
|
|
99
|
-
|
|
75
|
+
const secMethods = function (instance) {
|
|
100
76
|
copyMethods(instance);
|
|
101
77
|
copyPropMethods(instance);
|
|
102
78
|
};
|
|
103
|
-
|
|
79
|
+
const formatLogParams = function (params) {
|
|
104
80
|
let logParamsStr = '';
|
|
105
|
-
|
|
81
|
+
const paramsKeyList = Object.keys(params);
|
|
106
82
|
for (let i = 0; i < paramsKeyList.length; i++) {
|
|
107
83
|
const paramKey = paramsKeyList[i];
|
|
108
84
|
logParamsStr += `${paramKey}:${params[paramKey]}`;
|
|
@@ -113,32 +89,46 @@ let formatLogParams = function (params) {
|
|
|
113
89
|
return logParamsStr;
|
|
114
90
|
};
|
|
115
91
|
const getComponentNO = function () {
|
|
116
|
-
var _a;
|
|
92
|
+
var _a, _b;
|
|
117
93
|
let componentName = '';
|
|
118
94
|
// @ts-ignore
|
|
119
|
-
if (
|
|
95
|
+
if ((_a = window === null || window === void 0 ? void 0 : window.__TRTCElectron) === null || _a === void 0 ? void 0 : _a.componentName) {
|
|
120
96
|
// @ts-ignore
|
|
121
|
-
componentName =
|
|
97
|
+
componentName = window.__TRTCElectron.componentName;
|
|
122
98
|
}
|
|
123
99
|
else {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
componentName
|
|
100
|
+
if ((_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.getItem) {
|
|
101
|
+
const jsonStr = window.localStorage.getItem('__TRTCElectron');
|
|
102
|
+
if (jsonStr) {
|
|
103
|
+
try {
|
|
104
|
+
const jsonObj = JSON.parse(jsonStr);
|
|
105
|
+
if (jsonObj.componentName && typeof jsonObj.componentName === 'string') {
|
|
106
|
+
componentName = jsonObj.componentName;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.warn('trtc: localstorage TRTCElectron parse error.', error);
|
|
130
111
|
}
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
console.warn('trtc: localstorage TRTCElectron parse error.', error);
|
|
134
112
|
}
|
|
135
113
|
}
|
|
114
|
+
else {
|
|
115
|
+
/**
|
|
116
|
+
* localStorage not defined or accessing is denied.
|
|
117
|
+
*
|
|
118
|
+
* Will occur when third-party scripts cookies are disallowed and access to localStorage may result in thrown SecurityError exceptions.
|
|
119
|
+
* ref 1: https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document/
|
|
120
|
+
* ref 2: https://cloud.tencent.com/developer/article/1803097
|
|
121
|
+
*/
|
|
122
|
+
}
|
|
136
123
|
}
|
|
137
124
|
let componentNO = '';
|
|
138
125
|
switch (componentName) {
|
|
139
126
|
case 'TUIRoom':
|
|
140
127
|
componentNO = '5';
|
|
141
128
|
break;
|
|
129
|
+
case 'TUIRoomKit':
|
|
130
|
+
componentNO = '16';
|
|
131
|
+
break;
|
|
142
132
|
default:
|
|
143
133
|
break;
|
|
144
134
|
}
|
|
@@ -668,11 +658,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
668
658
|
return !(userId === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub);
|
|
669
659
|
});
|
|
670
660
|
}
|
|
671
|
-
if (
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
661
|
+
if (screenVideoBufferMap.has(userId)) {
|
|
662
|
+
const targetVideoBuffer = screenVideoBufferMap.get(userId);
|
|
663
|
+
if (targetVideoBuffer && targetVideoBuffer.buffer) {
|
|
664
|
+
this.rtcCloud.setSubVideoBuffer(userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, 0, 0, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
665
|
+
targetVideoBuffer.buffer = null;
|
|
666
|
+
}
|
|
667
|
+
screenVideoBufferMap.delete(userId);
|
|
676
668
|
}
|
|
677
669
|
}
|
|
678
670
|
this.fire('onUserSubStreamAvailable', userId, available);
|
|
@@ -1104,15 +1096,21 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1104
1096
|
handleOnScreenCaptureStarted() {
|
|
1105
1097
|
this.isScreenCapturing = true;
|
|
1106
1098
|
// 只有在 Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1099
|
+
const currentUserId = '';
|
|
1100
|
+
let targetVideoBuffer = screenVideoBufferMap.get(currentUserId);
|
|
1101
|
+
if (!targetVideoBuffer || !targetVideoBuffer.buffer) {
|
|
1102
|
+
if (!targetVideoBuffer) {
|
|
1103
|
+
targetVideoBuffer = new trtc_define_1.VideoBufferInfo();
|
|
1104
|
+
}
|
|
1105
|
+
targetVideoBuffer.userId = currentUserId;
|
|
1106
|
+
targetVideoBuffer.streamType = this.screenCaptureStreamType;
|
|
1107
|
+
targetVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength);
|
|
1108
|
+
targetVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1109
|
+
targetVideoBuffer.pixelFormat = this.pixelformate;
|
|
1110
|
+
targetVideoBuffer.width = DEFAULT_VIDEO_WIDTH;
|
|
1111
|
+
targetVideoBuffer.height = DEFAULT_VIDEO_HEIGHT;
|
|
1112
|
+
this.rtcCloud.setSubVideoBuffer(targetVideoBuffer.userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, targetVideoBuffer.width, targetVideoBuffer.height, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1113
|
+
screenVideoBufferMap.set(targetVideoBuffer.userId, targetVideoBuffer);
|
|
1116
1114
|
}
|
|
1117
1115
|
this.fire('onScreenCaptureStarted');
|
|
1118
1116
|
}
|
|
@@ -1142,10 +1140,14 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1142
1140
|
*/
|
|
1143
1141
|
handleOnScreenCaptureStopped(reason) {
|
|
1144
1142
|
if (this.isScreenCapturing) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1143
|
+
const currentUserId = '';
|
|
1144
|
+
const targetVideoBuffer = screenVideoBufferMap.get(currentUserId);
|
|
1145
|
+
if (targetVideoBuffer) {
|
|
1146
|
+
if (targetVideoBuffer.buffer) {
|
|
1147
|
+
this.rtcCloud.setSubVideoBuffer(targetVideoBuffer.userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, 0, 0, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1148
|
+
targetVideoBuffer.buffer = null;
|
|
1149
|
+
}
|
|
1150
|
+
screenVideoBufferMap.delete(currentUserId);
|
|
1149
1151
|
}
|
|
1150
1152
|
this.isScreenCapturing = false;
|
|
1151
1153
|
}
|
|
@@ -1290,7 +1292,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1290
1292
|
if (remoteUserVideoBuffers) {
|
|
1291
1293
|
if (streamType === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig && remoteUserVideoBuffers.big) {
|
|
1292
1294
|
if (remoteUserVideoBuffers.big.width !== width || remoteUserVideoBuffers.big.height !== height) {
|
|
1293
|
-
remoteUserVideoBuffers.big.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength
|
|
1295
|
+
remoteUserVideoBuffers.big.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1294
1296
|
remoteUserVideoBuffers.big.id = (0, util_1.generateUniqueId)();
|
|
1295
1297
|
remoteUserVideoBuffers.big.width = width;
|
|
1296
1298
|
remoteUserVideoBuffers.big.height = height;
|
|
@@ -1300,7 +1302,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1300
1302
|
}
|
|
1301
1303
|
else if (streamType === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSmall && remoteUserVideoBuffers.small) {
|
|
1302
1304
|
if (remoteUserVideoBuffers.small.width !== width || remoteUserVideoBuffers.small.height !== height) {
|
|
1303
|
-
remoteUserVideoBuffers.small.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength
|
|
1305
|
+
remoteUserVideoBuffers.small.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1304
1306
|
remoteUserVideoBuffers.small.id = (0, util_1.generateUniqueId)();
|
|
1305
1307
|
remoteUserVideoBuffers.small.width = width;
|
|
1306
1308
|
remoteUserVideoBuffers.small.height = height;
|
|
@@ -1315,13 +1317,19 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1315
1317
|
}
|
|
1316
1318
|
else {
|
|
1317
1319
|
// 远端用户屏幕分享
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1320
|
+
const targetVideoBuffer = screenVideoBufferMap.get(userId);
|
|
1321
|
+
if (targetVideoBuffer) {
|
|
1322
|
+
if (targetVideoBuffer.width !== width || targetVideoBuffer.height !== height) {
|
|
1323
|
+
targetVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1324
|
+
targetVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1325
|
+
targetVideoBuffer.width = width;
|
|
1326
|
+
targetVideoBuffer.height = height;
|
|
1327
|
+
targetVideoBuffer.pixelFormat = this.pixelformate;
|
|
1328
|
+
this.rtcCloud.setSubVideoBuffer(userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, width, height, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
console.error('trtc: remote user screen-share video buffer not exist');
|
|
1325
1333
|
}
|
|
1326
1334
|
}
|
|
1327
1335
|
}
|
|
@@ -1329,20 +1337,27 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1329
1337
|
// 本地用户
|
|
1330
1338
|
if (this.isScreenCapturing && this.screenCaptureStreamType === streamType) {
|
|
1331
1339
|
// 本地屏幕分享
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1340
|
+
const currentUserId = '';
|
|
1341
|
+
const targetVideoBuffer = screenVideoBufferMap.get(currentUserId);
|
|
1342
|
+
if (targetVideoBuffer) {
|
|
1343
|
+
if (targetVideoBuffer.width !== width || targetVideoBuffer.height !== height) {
|
|
1344
|
+
targetVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1345
|
+
targetVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1346
|
+
targetVideoBuffer.width = width;
|
|
1347
|
+
targetVideoBuffer.height = height;
|
|
1348
|
+
targetVideoBuffer.pixelFormat = this.pixelformate;
|
|
1349
|
+
this.rtcCloud.setSubVideoBuffer(currentUserId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, width, height, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
else {
|
|
1353
|
+
console.error('trtc: current user screen-share video buffer not exist');
|
|
1339
1354
|
}
|
|
1340
1355
|
}
|
|
1341
1356
|
else {
|
|
1342
1357
|
if (userId === CAMERA_DEVICE_TEST_ID) {
|
|
1343
1358
|
// 摄像头检测
|
|
1344
1359
|
if (cameraTestVideoBuffer.width !== width || cameraTestVideoBuffer.height !== height) {
|
|
1345
|
-
cameraTestVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength
|
|
1360
|
+
cameraTestVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1346
1361
|
cameraTestVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1347
1362
|
cameraTestVideoBuffer.width = width;
|
|
1348
1363
|
cameraTestVideoBuffer.height = height;
|
|
@@ -1353,7 +1368,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1353
1368
|
else {
|
|
1354
1369
|
// 本地摄像头
|
|
1355
1370
|
if (localVideoBuffer.width !== width || localVideoBuffer.height !== height) {
|
|
1356
|
-
localVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength
|
|
1371
|
+
localVideoBuffer.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1357
1372
|
localVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1358
1373
|
localVideoBuffer.width = width;
|
|
1359
1374
|
localVideoBuffer.height = height;
|
|
@@ -1448,12 +1463,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1448
1463
|
localVideoBuffer.buffer = null;
|
|
1449
1464
|
localVideoBuffer.id = 0;
|
|
1450
1465
|
}
|
|
1451
|
-
|
|
1452
|
-
this.rtcCloud.setSubVideoBuffer(
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
}
|
|
1466
|
+
screenVideoBufferMap.forEach((videoBufferInfo, key) => {
|
|
1467
|
+
this.rtcCloud.setSubVideoBuffer(videoBufferInfo.userId, videoBufferInfo.buffer, videoBufferInfo.streamType, 0, 0, videoBufferInfo.pixelFormat, videoBufferInfo.id);
|
|
1468
|
+
videoBufferInfo.buffer = null;
|
|
1469
|
+
});
|
|
1470
|
+
screenVideoBufferMap.clear();
|
|
1457
1471
|
if (cameraTestVideoBuffer.buffer) {
|
|
1458
1472
|
this.rtcCloud.setCameraTestVideoBuffer(cameraTestVideoBuffer.buffer, 0, 0, cameraTestVideoBuffer.pixelFormat, cameraTestVideoBuffer.id);
|
|
1459
1473
|
cameraTestVideoBuffer.buffer = null;
|
|
@@ -1745,7 +1759,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1745
1759
|
// 只有在 Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1746
1760
|
if (!localVideoBuffer.buffer) {
|
|
1747
1761
|
localVideoBuffer.streamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
1748
|
-
localVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength
|
|
1762
|
+
localVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength);
|
|
1749
1763
|
localVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
1750
1764
|
localVideoBuffer.pixelFormat = this.pixelformate;
|
|
1751
1765
|
localVideoBuffer.width = DEFAULT_VIDEO_WIDTH;
|
|
@@ -1849,15 +1863,14 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1849
1863
|
}
|
|
1850
1864
|
// view 为 null 时,可能启动了自定义渲染,所以 Buffer 还是要创建,否则自定义渲染就拿不到数据;
|
|
1851
1865
|
// view 非 null 时,当然必须创建 Buffer
|
|
1852
|
-
const videoBufferInfo = {
|
|
1866
|
+
const videoBufferInfo = new trtc_define_1.VideoBufferInfo({
|
|
1853
1867
|
userId: userId,
|
|
1854
|
-
buffer: (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength, userId, streamType),
|
|
1855
1868
|
id: (0, util_1.generateUniqueId)(),
|
|
1856
1869
|
streamType: streamType,
|
|
1857
1870
|
width: DEFAULT_VIDEO_WIDTH,
|
|
1858
1871
|
height: DEFAULT_VIDEO_HEIGHT,
|
|
1859
1872
|
pixelFormat: this.pixelformate,
|
|
1860
|
-
};
|
|
1873
|
+
});
|
|
1861
1874
|
if (streamType !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub) {
|
|
1862
1875
|
const remoteUserVideoBuffers = remoteVideoBufferMap.get(userId);
|
|
1863
1876
|
if (!remoteUserVideoBuffers) {
|
|
@@ -1884,9 +1897,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1884
1897
|
else {
|
|
1885
1898
|
// 远端屏幕分享
|
|
1886
1899
|
// Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1900
|
+
let targetVideoBuffer = screenVideoBufferMap.get(userId);
|
|
1901
|
+
if (!targetVideoBuffer || !targetVideoBuffer.buffer) {
|
|
1902
|
+
targetVideoBuffer = videoBufferInfo;
|
|
1903
|
+
this.rtcCloud.setSubVideoBuffer(targetVideoBuffer.userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, targetVideoBuffer.width, targetVideoBuffer.height, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1904
|
+
screenVideoBufferMap.set(userId, targetVideoBuffer);
|
|
1890
1905
|
}
|
|
1891
1906
|
}
|
|
1892
1907
|
this.addRemoteVideoRenderCallback(userId);
|
|
@@ -1927,11 +1942,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1927
1942
|
remoteVideoBufferMap.delete(userId);
|
|
1928
1943
|
}
|
|
1929
1944
|
}
|
|
1930
|
-
else
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1945
|
+
else {
|
|
1946
|
+
const targetVideoBuffer = screenVideoBufferMap.get(userId);
|
|
1947
|
+
if (targetVideoBuffer && targetVideoBuffer.streamType === streamType) {
|
|
1948
|
+
this.rtcCloud.setSubVideoBuffer(userId, targetVideoBuffer.buffer, targetVideoBuffer.streamType, 0, 0, targetVideoBuffer.pixelFormat, targetVideoBuffer.id);
|
|
1949
|
+
targetVideoBuffer.buffer = null;
|
|
1950
|
+
screenVideoBufferMap.delete(userId);
|
|
1951
|
+
}
|
|
1935
1952
|
}
|
|
1936
1953
|
}
|
|
1937
1954
|
/**
|
|
@@ -1994,12 +2011,16 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1994
2011
|
}
|
|
1995
2012
|
});
|
|
1996
2013
|
remoteVideoBufferMap.clear();
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2014
|
+
const currentUserId = '';
|
|
2015
|
+
screenVideoBufferMap.forEach((videoBufferInfo, key) => {
|
|
2016
|
+
if (key !== currentUserId) {
|
|
2017
|
+
if (videoBufferInfo.buffer) {
|
|
2018
|
+
this.rtcCloud.setSubVideoBuffer(videoBufferInfo.userId, videoBufferInfo.buffer, videoBufferInfo.streamType, 0, 0, videoBufferInfo.pixelFormat, videoBufferInfo.id);
|
|
2019
|
+
videoBufferInfo.buffer = null;
|
|
2020
|
+
}
|
|
2021
|
+
screenVideoBufferMap.delete(videoBufferInfo.userId);
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2003
2024
|
}
|
|
2004
2025
|
/**
|
|
2005
2026
|
* 3.9 暂停接收指定的远端视频流
|
|
@@ -2257,15 +2278,14 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2257
2278
|
setRemoteVideoStreamType(userId, streamType) {
|
|
2258
2279
|
const remoteUserVideoBuffers = remoteVideoBufferMap.get(userId);
|
|
2259
2280
|
if (remoteUserVideoBuffers) {
|
|
2260
|
-
const videoBufferInfo = {
|
|
2281
|
+
const videoBufferInfo = new trtc_define_1.VideoBufferInfo({
|
|
2261
2282
|
userId: userId,
|
|
2262
|
-
buffer: (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength, userId, streamType),
|
|
2263
2283
|
id: (0, util_1.generateUniqueId)(),
|
|
2264
2284
|
streamType: streamType,
|
|
2265
2285
|
width: DEFAULT_VIDEO_WIDTH,
|
|
2266
2286
|
height: DEFAULT_VIDEO_HEIGHT,
|
|
2267
2287
|
pixelFormat: this.pixelformate,
|
|
2268
|
-
};
|
|
2288
|
+
});
|
|
2269
2289
|
if (streamType === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig && !remoteUserVideoBuffers.big) {
|
|
2270
2290
|
remoteUserVideoBuffers.big = videoBufferInfo;
|
|
2271
2291
|
this.rtcCloud.setRemoteVideoBuffer(userId, videoBufferInfo.buffer, videoBufferInfo.streamType, videoBufferInfo.width, videoBufferInfo.height, videoBufferInfo.pixelFormat, videoBufferInfo.id);
|
|
@@ -2988,7 +3008,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2988
3008
|
console.error('trtc:startScreenCapture, params is not instanceof TRTCVideoEncParam!');
|
|
2989
3009
|
return;
|
|
2990
3010
|
}
|
|
2991
|
-
|
|
3011
|
+
const currentUserId = '';
|
|
3012
|
+
const targetVideoBuffer = screenVideoBufferMap.get(currentUserId);
|
|
3013
|
+
if (this.isScreenCapturing && this.screenCaptureStreamType !== type && targetVideoBuffer && targetVideoBuffer.buffer) {
|
|
2992
3014
|
// 已经在分享中,切换分享流类型,停止当前正在进行的分享
|
|
2993
3015
|
this.stopScreenCapture();
|
|
2994
3016
|
}
|
|
@@ -3158,10 +3180,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3158
3180
|
if (userId !== undefined && userId !== null
|
|
3159
3181
|
&& pixelFormat !== undefined && bufferType !== undefined && callback !== undefined) {
|
|
3160
3182
|
if (callback !== null) {
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
this.remoteVideoCallback.set(String(userId),
|
|
3183
|
+
const remoteCallback = new VideoRenderCallback();
|
|
3184
|
+
remoteCallback.callback = callback;
|
|
3185
|
+
remoteCallback.pixelFormat = pixelFormat;
|
|
3186
|
+
this.remoteVideoCallback.set(String(userId), remoteCallback);
|
|
3165
3187
|
}
|
|
3166
3188
|
else {
|
|
3167
3189
|
this.remoteVideoCallback.delete(String(userId));
|
|
@@ -3647,7 +3669,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3647
3669
|
const streamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
3648
3670
|
cameraTestVideoBuffer.streamType = streamType;
|
|
3649
3671
|
cameraTestVideoBuffer.pixelFormat = this.pixelformate;
|
|
3650
|
-
cameraTestVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength
|
|
3672
|
+
cameraTestVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength);
|
|
3651
3673
|
cameraTestVideoBuffer.id = (0, util_1.generateUniqueId)();
|
|
3652
3674
|
cameraTestVideoBuffer.width = DEFAULT_VIDEO_WIDTH;
|
|
3653
3675
|
cameraTestVideoBuffer.height = DEFAULT_VIDEO_HEIGHT;
|
|
@@ -3815,8 +3837,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3815
3837
|
this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation, valid, bufferId) => {
|
|
3816
3838
|
if (this.enableRenderFrame) {
|
|
3817
3839
|
if (valid === 1) {
|
|
3818
|
-
|
|
3819
|
-
|
|
3840
|
+
const currentUserId = '';
|
|
3841
|
+
const localScreenShareVideoBuffer = screenVideoBufferMap.get(currentUserId);
|
|
3842
|
+
if (this.isScreenCapturing
|
|
3843
|
+
&& this.screenCaptureStreamType === type
|
|
3844
|
+
&& localScreenShareVideoBuffer
|
|
3845
|
+
&& localScreenShareVideoBuffer.id === bufferId) {
|
|
3846
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, localScreenShareVideoBuffer.buffer);
|
|
3820
3847
|
}
|
|
3821
3848
|
else if (localVideoBuffer.id === bufferId) {
|
|
3822
3849
|
this._onRenderFrame(id, type, width, height, timestamp, rotation, localVideoBuffer.buffer);
|
|
@@ -3833,6 +3860,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3833
3860
|
}
|
|
3834
3861
|
addRemoteVideoRenderCallback(userId) {
|
|
3835
3862
|
this.rtcCloud.addRemoteVideoRenderCallback(userId, (id, type, width, height, timestamp, rotation, valid, bufferId) => {
|
|
3863
|
+
var _a, _b;
|
|
3836
3864
|
if (this.enableRenderFrame) {
|
|
3837
3865
|
if (valid === 1) {
|
|
3838
3866
|
const remoteUserVideoBuffers = remoteVideoBufferMap.get(id);
|
|
@@ -3845,9 +3873,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3845
3873
|
this._onRenderFrame(id, type, width, height, timestamp, rotation, remoteUserVideoBuffers.small.buffer);
|
|
3846
3874
|
}
|
|
3847
3875
|
}
|
|
3848
|
-
else if (
|
|
3876
|
+
else if (((_a = screenVideoBufferMap.get(id)) === null || _a === void 0 ? void 0 : _a.id) === bufferId) {
|
|
3849
3877
|
// 辅流
|
|
3850
|
-
this._onRenderFrame(id, type, width, height, timestamp, rotation,
|
|
3878
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, (_b = screenVideoBufferMap.get(id)) === null || _b === void 0 ? void 0 : _b.buffer);
|
|
3851
3879
|
}
|
|
3852
3880
|
else {
|
|
3853
3881
|
console.log(`trtc: ${id} ${type} video buffer reallocated`);
|
|
@@ -4016,7 +4044,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
4016
4044
|
this._onRealRender(uid, streamType, width, height, timestamp, rotation, data);
|
|
4017
4045
|
}
|
|
4018
4046
|
//回调远程给用户数据
|
|
4019
|
-
|
|
4047
|
+
const remoteCallback = this.remoteVideoCallback.get(uid);
|
|
4020
4048
|
if (remoteCallback !== undefined &&
|
|
4021
4049
|
remoteCallback !== null &&
|
|
4022
4050
|
remoteCallback.callback !== undefined &&
|
package/liteav/trtc_define.d.ts
CHANGED
|
@@ -772,7 +772,7 @@ export interface PluginInfo {
|
|
|
772
772
|
setParameter: (param: string) => number;
|
|
773
773
|
getParameter: (paramKey: string) => string;
|
|
774
774
|
}
|
|
775
|
-
export
|
|
775
|
+
export declare class VideoBufferInfo {
|
|
776
776
|
id: number;
|
|
777
777
|
userId: string;
|
|
778
778
|
buffer: Buffer | null;
|
|
@@ -780,4 +780,13 @@ export interface VideoBufferInfo {
|
|
|
780
780
|
width: number;
|
|
781
781
|
height: number;
|
|
782
782
|
pixelFormat: TRTCVideoPixelFormat;
|
|
783
|
+
pixelLength: number;
|
|
784
|
+
constructor(options?: {
|
|
785
|
+
id: number;
|
|
786
|
+
userId: string;
|
|
787
|
+
width: number;
|
|
788
|
+
height: number;
|
|
789
|
+
streamType: TRTCVideoStreamType;
|
|
790
|
+
pixelFormat: TRTCVideoPixelFormat;
|
|
791
|
+
});
|
|
783
792
|
}
|
package/liteav/trtc_define.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = exports.TRTCTranscodingConfig = exports.TRTCAudioRecordingContent = exports.TRTCMixInputType = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = exports.TRTCSpeedTestParams = exports.TRTCVolumeInfo = exports.TRTCQualityInfo = exports.TRTCNetworkQosParam = exports.TRTCRenderParams = exports.TRTCVideoEncParam = exports.TRTCParams = exports.TRTCWaterMarkSrcType = exports.TRTCDeviceType = exports.TRTCDeviceState = exports.TRTCLogLevel = exports.TRTCVideoFrame = exports.TRTCDeviceInfo = exports.TRTCScreenCaptureProperty = exports.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCRecordType = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
|
|
9
|
+
exports.VideoBufferInfo = exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = exports.TRTCTranscodingConfig = exports.TRTCAudioRecordingContent = exports.TRTCMixInputType = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = exports.TRTCSpeedTestParams = exports.TRTCVolumeInfo = exports.TRTCQualityInfo = exports.TRTCNetworkQosParam = exports.TRTCRenderParams = exports.TRTCVideoEncParam = exports.TRTCParams = exports.TRTCWaterMarkSrcType = exports.TRTCDeviceType = exports.TRTCDeviceState = exports.TRTCLogLevel = exports.TRTCVideoFrame = exports.TRTCDeviceInfo = exports.TRTCScreenCaptureProperty = exports.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCRecordType = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
|
|
10
|
+
const util_1 = require("./Renderer/util");
|
|
10
11
|
/////////////////////////////////////////////////////////////////////////////////
|
|
11
12
|
//
|
|
12
13
|
// 【(一)视频相关枚举值定义】
|
|
@@ -1395,3 +1396,27 @@ class TRTCSwitchRoomParam {
|
|
|
1395
1396
|
}
|
|
1396
1397
|
}
|
|
1397
1398
|
exports.TRTCSwitchRoomParam = TRTCSwitchRoomParam;
|
|
1399
|
+
class VideoBufferInfo {
|
|
1400
|
+
constructor(options) {
|
|
1401
|
+
this.id = -1;
|
|
1402
|
+
this.userId = "";
|
|
1403
|
+
this.buffer = null;
|
|
1404
|
+
this.streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
1405
|
+
this.width = 0;
|
|
1406
|
+
this.height = 0;
|
|
1407
|
+
this.pixelFormat = TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
|
|
1408
|
+
this.pixelLength = 1.5;
|
|
1409
|
+
if (options) {
|
|
1410
|
+
const { id, userId, width, height, streamType, pixelFormat } = options;
|
|
1411
|
+
this.id = id;
|
|
1412
|
+
this.userId = userId;
|
|
1413
|
+
this.width = width;
|
|
1414
|
+
this.height = height;
|
|
1415
|
+
this.streamType = streamType;
|
|
1416
|
+
this.pixelFormat = pixelFormat;
|
|
1417
|
+
this.pixelLength = this.pixelFormat === TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420 ? 1.5 : 4;
|
|
1418
|
+
this.buffer = (0, util_1.allocBuffer)(width * height * this.pixelLength);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
exports.VideoBufferInfo = VideoBufferInfo;
|