trtc-electron-sdk 10.6.115-beta.2 → 10.6.115-beta.3
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.
|
@@ -112,7 +112,7 @@ export declare enum TRTCLocalMediaTranscodingSourceType {
|
|
|
112
112
|
MediaSourceImage = 2,
|
|
113
113
|
MediaSourceRemoteVideo = 3
|
|
114
114
|
}
|
|
115
|
-
export
|
|
115
|
+
export type TRTCLocalMediaTranscodingSource = {
|
|
116
116
|
sourceType: TRTCLocalMediaTranscodingSourceType;
|
|
117
117
|
cameraDeviceId?: string;
|
|
118
118
|
screenSourceId?: string;
|
|
@@ -120,8 +120,9 @@ export declare type TRTCLocalMediaTranscodingSource = {
|
|
|
120
120
|
userId?: string;
|
|
121
121
|
rect: Rect;
|
|
122
122
|
zOrder: number;
|
|
123
|
+
renderParams: TRTCRenderParams;
|
|
123
124
|
};
|
|
124
|
-
export
|
|
125
|
+
export type TRTCLocalMediaTranscodingParams = {
|
|
125
126
|
inputSourceList: TRTCLocalMediaTranscodingSource[];
|
|
126
127
|
videoEncoderParams: TRTCVideoEncParam;
|
|
127
128
|
canvasColor: number;
|
|
@@ -132,7 +133,7 @@ export declare enum TRTCCameraCaptureMode {
|
|
|
132
133
|
CameraResolutionStrategyHighQuality = 2,
|
|
133
134
|
CameraCaptureManual = 3
|
|
134
135
|
}
|
|
135
|
-
export
|
|
136
|
+
export type TRTCCameraCaptureParams = {
|
|
136
137
|
/** 摄像头采集偏好 */
|
|
137
138
|
mode: TRTCCameraCaptureMode;
|
|
138
139
|
/** 采集图像宽度 */
|
|
@@ -190,43 +191,36 @@ export declare type TRTCCameraCaptureParams = {
|
|
|
190
191
|
* console.log(`onScreenSourceStopped { sourceId:${sourceId}, reason:${reason} }`);
|
|
191
192
|
* });
|
|
192
193
|
* // 监听图片事件
|
|
193
|
-
*
|
|
194
|
+
* localMediaTranscoder.on('onImageSourceStarted', (imagePath: string, errCode: number, errMsg: string) => {
|
|
194
195
|
* console.log(`onImageSourceStarted { imagePath:${imagePath} errCode:${errCode} errMsg:${errMsg} }`);
|
|
195
196
|
* });
|
|
196
|
-
*
|
|
197
|
+
* localMediaTranscoder.on('onImageSourceStopped', (imagePath: string) => {
|
|
197
198
|
* console.log(`onImageSourceStopped { imagePath:${imagePath} }`);
|
|
198
199
|
* });
|
|
199
200
|
*
|
|
200
201
|
* // 开启摄像头一
|
|
201
|
-
* localMediaTranscoder.startCameraSource(
|
|
202
|
+
* localMediaTranscoder.startCameraSource(cameraList[0].deviceId);
|
|
203
|
+
* localMediaTranscoder.setCameraCaptureParams(
|
|
202
204
|
* cameraList[0].deviceId,
|
|
203
205
|
* {
|
|
204
206
|
* mode: TRTCCameraCaptureMode.CameraResolutionStrategyAuto,
|
|
205
|
-
* width:
|
|
206
|
-
* height:
|
|
207
|
-
* },
|
|
208
|
-
* {
|
|
209
|
-
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
210
|
-
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
211
|
-
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable,
|
|
207
|
+
* width: 480,
|
|
208
|
+
* height: 480,
|
|
212
209
|
* }
|
|
213
210
|
* );
|
|
214
211
|
*
|
|
215
212
|
* // 开启摄像头二
|
|
216
|
-
* localMediaTranscoder.startCameraSource(
|
|
213
|
+
* localMediaTranscoder.startCameraSource(cameraList[1].deviceId);
|
|
214
|
+
* localMediaTranscoder.setCameraCaptureParams(
|
|
217
215
|
* cameraList[1].deviceId,
|
|
218
216
|
* {
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* },
|
|
223
|
-
* {
|
|
224
|
-
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
225
|
-
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
226
|
-
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable
|
|
217
|
+
* mode: TRTCCameraCaptureMode.CameraResolutionStrategyAuto,
|
|
218
|
+
* width: 960,
|
|
219
|
+
* height: 540
|
|
227
220
|
* }
|
|
228
221
|
* );
|
|
229
222
|
*
|
|
223
|
+
*
|
|
230
224
|
* // 开启屏幕一
|
|
231
225
|
* localMediaTranscoder.startScreenSource(screenSourceList[0], {top:10, left:10, right:1200, bottom:800});
|
|
232
226
|
*
|
|
@@ -249,14 +243,22 @@ export declare type TRTCCameraCaptureParams = {
|
|
|
249
243
|
* cameraDeviceId: cameraList[0].deviceId,
|
|
250
244
|
* rect: { left: 0, top: 0, right: 320, bottom: 180 },
|
|
251
245
|
* zOrder: 1,
|
|
252
|
-
*
|
|
246
|
+
* renderParams: {
|
|
247
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
248
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
249
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable
|
|
250
|
+
* },
|
|
253
251
|
* },
|
|
254
252
|
* { // camera 2
|
|
255
253
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceCamera,
|
|
256
254
|
* cameraDeviceId: cameraList[1].deviceId,
|
|
257
255
|
* rect: {left: 320 + 20, top: 180 + 20, right: 640 + 20, bottom: 360 + 20},
|
|
258
256
|
* zOrder: 2,
|
|
259
|
-
*
|
|
257
|
+
* renderParams: {
|
|
258
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation90,
|
|
259
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
260
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable
|
|
261
|
+
* },
|
|
260
262
|
* },
|
|
261
263
|
* {
|
|
262
264
|
* // screen 1
|
|
@@ -264,7 +266,11 @@ export declare type TRTCCameraCaptureParams = {
|
|
|
264
266
|
* screenSourceId: screenSourceList[0].sourceId,
|
|
265
267
|
* rect: {left: 320 + 20, top: 0, right: 640 + 20, bottom: 180},
|
|
266
268
|
* zOrder: 3,
|
|
267
|
-
*
|
|
269
|
+
* renderParams: {
|
|
270
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation180,
|
|
271
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
272
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable
|
|
273
|
+
* },
|
|
268
274
|
* },
|
|
269
275
|
* {
|
|
270
276
|
* // screen 2
|
|
@@ -272,21 +278,33 @@ export declare type TRTCCameraCaptureParams = {
|
|
|
272
278
|
* screenSourceId: screenSourceList[1].sourceId,
|
|
273
279
|
* rect: {left: 0, top: 180 + 20, right: 320, bottom: 360 + 20},
|
|
274
280
|
* zOrder: 4,
|
|
275
|
-
*
|
|
281
|
+
* renderParams: {
|
|
282
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation270,
|
|
283
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
284
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Auto
|
|
285
|
+
* },
|
|
276
286
|
* },
|
|
277
287
|
* { // image 1
|
|
278
288
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceImage,
|
|
279
289
|
* imagePath: '<please set valid image path>',
|
|
280
290
|
* rect: {left: 0, top: 360 + 40, right: 320, bottom: 540 + 40},
|
|
281
291
|
* zOrder: 5,
|
|
282
|
-
*
|
|
292
|
+
* renderParams: {
|
|
293
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation90, // 不会生效,参数设置将被忽略
|
|
294
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
295
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable // 不会生效,参数设置将被忽略
|
|
296
|
+
* },
|
|
283
297
|
* },
|
|
284
298
|
* { // image 2
|
|
285
299
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceImage,
|
|
286
300
|
* imagePath: '<please set valid image path>',
|
|
287
301
|
* rect: {left: 320 + 20, top: 360 + 40, right: 640, bottom: 540 + 40},
|
|
288
302
|
* zOrder: 5,
|
|
289
|
-
*
|
|
303
|
+
* renderParams: {
|
|
304
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation0, // 不会生效,参数设置将被忽略
|
|
305
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
306
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable // 不会生效,参数设置将被忽略
|
|
307
|
+
* },
|
|
290
308
|
* }
|
|
291
309
|
* ],
|
|
292
310
|
* videoEncoderParams: {
|
|
@@ -343,12 +361,17 @@ declare class TRTCLocalMediaTranscoder extends EventEmitter {
|
|
|
343
361
|
* 启动摄像头采集
|
|
344
362
|
*
|
|
345
363
|
* @param deviceId {String} - 摄像头设备 Id
|
|
346
|
-
* @param transcodeParams {TRTCCameraCaptureParams} - 指定摄像头采集分辨率和帧率
|
|
347
|
-
* @param renderParams {TRTCRenderParams} - 指定摄像头数据源是否旋转、镜像和填充模式
|
|
348
364
|
*
|
|
349
365
|
* @fires [onCameraSourceStarted]{@link TRTCLocalMediaTranscodingEvent#onCameraSourceStarted}
|
|
350
366
|
*/
|
|
351
|
-
startCameraSource(deviceId: string
|
|
367
|
+
startCameraSource(deviceId: string): void;
|
|
368
|
+
/**
|
|
369
|
+
* 设置摄像头采集参数
|
|
370
|
+
*
|
|
371
|
+
* @param deviceId {String} - 摄像头设备 Id
|
|
372
|
+
* @param cameraCaptureParams {TRTCCameraCaptureParams} - 指定摄像头采集分辨率和帧率
|
|
373
|
+
*/
|
|
374
|
+
setCameraCaptureParams(deviceId: string, cameraCaptureParams: TRTCCameraCaptureParams): void;
|
|
352
375
|
/**
|
|
353
376
|
* 停止摄像头采集
|
|
354
377
|
* @param deviceId {String} - 摄像头设备 Id
|
|
@@ -165,7 +165,7 @@ var TRTCLocalMediaTranscodingSourceType;
|
|
|
165
165
|
* 当 sourceType 为 TRTCMediaSourceCamera 时此字段有效,不过当前版本的 SDK 还不支持这个能力。
|
|
166
166
|
* @property {Rect} rect - 【字段含义】指定该路画面的坐标区域(单位:像素)。
|
|
167
167
|
* @property {Number} zOrder - 【字段含义】指定该路画面的层级(取值范围:0 - 15,不可重复)。
|
|
168
|
-
* @property {
|
|
168
|
+
* @property {TRTCRenderParams} renderParams - 【字段含义】指定该路数据源是否旋转、镜像和填充模式。
|
|
169
169
|
*/
|
|
170
170
|
const TRTCLocalMediaTranscodingSource_HACK_JSDOC = null;
|
|
171
171
|
/**
|
|
@@ -279,43 +279,36 @@ const TRTCCameraCaptureParams_HACK_JSDOC = null;
|
|
|
279
279
|
* console.log(`onScreenSourceStopped { sourceId:${sourceId}, reason:${reason} }`);
|
|
280
280
|
* });
|
|
281
281
|
* // 监听图片事件
|
|
282
|
-
*
|
|
282
|
+
* localMediaTranscoder.on('onImageSourceStarted', (imagePath: string, errCode: number, errMsg: string) => {
|
|
283
283
|
* console.log(`onImageSourceStarted { imagePath:${imagePath} errCode:${errCode} errMsg:${errMsg} }`);
|
|
284
284
|
* });
|
|
285
|
-
*
|
|
285
|
+
* localMediaTranscoder.on('onImageSourceStopped', (imagePath: string) => {
|
|
286
286
|
* console.log(`onImageSourceStopped { imagePath:${imagePath} }`);
|
|
287
287
|
* });
|
|
288
288
|
*
|
|
289
289
|
* // 开启摄像头一
|
|
290
|
-
* localMediaTranscoder.startCameraSource(
|
|
290
|
+
* localMediaTranscoder.startCameraSource(cameraList[0].deviceId);
|
|
291
|
+
* localMediaTranscoder.setCameraCaptureParams(
|
|
291
292
|
* cameraList[0].deviceId,
|
|
292
293
|
* {
|
|
293
294
|
* mode: TRTCCameraCaptureMode.CameraResolutionStrategyAuto,
|
|
294
|
-
* width:
|
|
295
|
-
* height:
|
|
296
|
-
* },
|
|
297
|
-
* {
|
|
298
|
-
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
299
|
-
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
300
|
-
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable,
|
|
295
|
+
* width: 480,
|
|
296
|
+
* height: 480,
|
|
301
297
|
* }
|
|
302
298
|
* );
|
|
303
299
|
*
|
|
304
300
|
* // 开启摄像头二
|
|
305
|
-
* localMediaTranscoder.startCameraSource(
|
|
301
|
+
* localMediaTranscoder.startCameraSource(cameraList[1].deviceId);
|
|
302
|
+
* localMediaTranscoder.setCameraCaptureParams(
|
|
306
303
|
* cameraList[1].deviceId,
|
|
307
304
|
* {
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* },
|
|
312
|
-
* {
|
|
313
|
-
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
314
|
-
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
315
|
-
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable
|
|
305
|
+
* mode: TRTCCameraCaptureMode.CameraResolutionStrategyAuto,
|
|
306
|
+
* width: 960,
|
|
307
|
+
* height: 540
|
|
316
308
|
* }
|
|
317
309
|
* );
|
|
318
310
|
*
|
|
311
|
+
*
|
|
319
312
|
* // 开启屏幕一
|
|
320
313
|
* localMediaTranscoder.startScreenSource(screenSourceList[0], {top:10, left:10, right:1200, bottom:800});
|
|
321
314
|
*
|
|
@@ -338,14 +331,22 @@ const TRTCCameraCaptureParams_HACK_JSDOC = null;
|
|
|
338
331
|
* cameraDeviceId: cameraList[0].deviceId,
|
|
339
332
|
* rect: { left: 0, top: 0, right: 320, bottom: 180 },
|
|
340
333
|
* zOrder: 1,
|
|
341
|
-
*
|
|
334
|
+
* renderParams: {
|
|
335
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation0,
|
|
336
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
337
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable
|
|
338
|
+
* },
|
|
342
339
|
* },
|
|
343
340
|
* { // camera 2
|
|
344
341
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceCamera,
|
|
345
342
|
* cameraDeviceId: cameraList[1].deviceId,
|
|
346
343
|
* rect: {left: 320 + 20, top: 180 + 20, right: 640 + 20, bottom: 360 + 20},
|
|
347
344
|
* zOrder: 2,
|
|
348
|
-
*
|
|
345
|
+
* renderParams: {
|
|
346
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation90,
|
|
347
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
348
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable
|
|
349
|
+
* },
|
|
349
350
|
* },
|
|
350
351
|
* {
|
|
351
352
|
* // screen 1
|
|
@@ -353,7 +354,11 @@ const TRTCCameraCaptureParams_HACK_JSDOC = null;
|
|
|
353
354
|
* screenSourceId: screenSourceList[0].sourceId,
|
|
354
355
|
* rect: {left: 320 + 20, top: 0, right: 640 + 20, bottom: 180},
|
|
355
356
|
* zOrder: 3,
|
|
356
|
-
*
|
|
357
|
+
* renderParams: {
|
|
358
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation180,
|
|
359
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
360
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable
|
|
361
|
+
* },
|
|
357
362
|
* },
|
|
358
363
|
* {
|
|
359
364
|
* // screen 2
|
|
@@ -361,21 +366,33 @@ const TRTCCameraCaptureParams_HACK_JSDOC = null;
|
|
|
361
366
|
* screenSourceId: screenSourceList[1].sourceId,
|
|
362
367
|
* rect: {left: 0, top: 180 + 20, right: 320, bottom: 360 + 20},
|
|
363
368
|
* zOrder: 4,
|
|
364
|
-
*
|
|
369
|
+
* renderParams: {
|
|
370
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation270,
|
|
371
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
372
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Auto
|
|
373
|
+
* },
|
|
365
374
|
* },
|
|
366
375
|
* { // image 1
|
|
367
376
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceImage,
|
|
368
377
|
* imagePath: '<please set valid image path>',
|
|
369
378
|
* rect: {left: 0, top: 360 + 40, right: 320, bottom: 540 + 40},
|
|
370
379
|
* zOrder: 5,
|
|
371
|
-
*
|
|
380
|
+
* renderParams: {
|
|
381
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation90, // 不会生效,参数设置将被忽略
|
|
382
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fit,
|
|
383
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Enable // 不会生效,参数设置将被忽略
|
|
384
|
+
* },
|
|
372
385
|
* },
|
|
373
386
|
* { // image 2
|
|
374
387
|
* sourceType: TRTCLocalMediaTranscodingSourceType.MediaSourceImage,
|
|
375
388
|
* imagePath: '<please set valid image path>',
|
|
376
389
|
* rect: {left: 320 + 20, top: 360 + 40, right: 640, bottom: 540 + 40},
|
|
377
390
|
* zOrder: 5,
|
|
378
|
-
*
|
|
391
|
+
* renderParams: {
|
|
392
|
+
* rotation: TRTCVideoRotation.TRTCVideoRotation0, // 不会生效,参数设置将被忽略
|
|
393
|
+
* fillMode: TRTCVideoFillMode.TRTCVideoFillMode_Fill,
|
|
394
|
+
* mirrorType: TRTCVideoMirrorType.TRTCVideoMirrorType_Disable // 不会生效,参数设置将被忽略
|
|
395
|
+
* },
|
|
379
396
|
* }
|
|
380
397
|
* ],
|
|
381
398
|
* videoEncoderParams: {
|
|
@@ -455,13 +472,20 @@ class TRTCLocalMediaTranscoder extends events_1.EventEmitter {
|
|
|
455
472
|
* 启动摄像头采集
|
|
456
473
|
*
|
|
457
474
|
* @param deviceId {String} - 摄像头设备 Id
|
|
458
|
-
* @param transcodeParams {TRTCCameraCaptureParams} - 指定摄像头采集分辨率和帧率
|
|
459
|
-
* @param renderParams {TRTCRenderParams} - 指定摄像头数据源是否旋转、镜像和填充模式
|
|
460
475
|
*
|
|
461
476
|
* @fires [onCameraSourceStarted]{@link TRTCLocalMediaTranscodingEvent#onCameraSourceStarted}
|
|
462
477
|
*/
|
|
463
|
-
startCameraSource(deviceId
|
|
464
|
-
this.nativeLocalMediaTranscoder.startCameraSource(deviceId
|
|
478
|
+
startCameraSource(deviceId) {
|
|
479
|
+
this.nativeLocalMediaTranscoder.startCameraSource(deviceId);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* 设置摄像头采集参数
|
|
483
|
+
*
|
|
484
|
+
* @param deviceId {String} - 摄像头设备 Id
|
|
485
|
+
* @param cameraCaptureParams {TRTCCameraCaptureParams} - 指定摄像头采集分辨率和帧率
|
|
486
|
+
*/
|
|
487
|
+
setCameraCaptureParams(deviceId, cameraCaptureParams) {
|
|
488
|
+
this.nativeLocalMediaTranscoder.setCameraCaptureParams(deviceId, cameraCaptureParams);
|
|
465
489
|
}
|
|
466
490
|
/**
|
|
467
491
|
* 停止摄像头采集
|
|
@@ -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;
|