trtc-electron-sdk 10.2.8-beta.4 → 10.3.8-beta.10
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/trtc.d.ts +3 -2
- package/liteav/trtc.js +57 -28
- package/package.json +1 -1
- package/liteav/trtc.10.0.100-beta.12.d.ts +0 -2036
- package/liteav/trtc.10.0.100-beta.12.js +0 -3789
package/liteav/trtc.d.ts
CHANGED
|
@@ -608,7 +608,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
608
608
|
* - ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332) :安装音频驱动插件失败
|
|
609
609
|
*/
|
|
610
610
|
handleOnSystemAudioLoopbackError(errCode: number): void;
|
|
611
|
-
|
|
611
|
+
handleVideoSizeChange(userId: string, streamType: number, width: number, height: number): void;
|
|
612
612
|
/**
|
|
613
613
|
* 1.1 进入房间
|
|
614
614
|
*
|
|
@@ -1940,8 +1940,9 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1940
1940
|
* 该方法测试麦克风是否能正常工作,volume 的取值范围为0 - 100。
|
|
1941
1941
|
*
|
|
1942
1942
|
* @param {Number} interval - 反馈音量提示的时间间隔(ms),建议设置到大于 200 毫秒
|
|
1943
|
+
* @param {Boolean} playback - 是否开启回播麦克风声音,开启后用户测试麦克风时会听到自己的声音。默认值 true
|
|
1943
1944
|
*/
|
|
1944
|
-
startMicDeviceTest(interval: number): void;
|
|
1945
|
+
startMicDeviceTest(interval: number, playback?: boolean): void;
|
|
1945
1946
|
/**
|
|
1946
1947
|
* 13.6 停止麦克风测试
|
|
1947
1948
|
*/
|
package/liteav/trtc.js
CHANGED
|
@@ -33,8 +33,8 @@ __exportStar(require("./trtc_code"), exports);
|
|
|
33
33
|
const CUSTOM_VIDEO_DATA = 'onVideoData';
|
|
34
34
|
const CAMERA_DEVICE_TEST_VIEW = 'camera_device_test_view';
|
|
35
35
|
const CAMERA_DEVICE_TEST_ID = 'camera_device_test';
|
|
36
|
-
const DEFAULT_VIDEO_WIDTH =
|
|
37
|
-
const DEFAULT_VIDEO_HEIGHT =
|
|
36
|
+
const DEFAULT_VIDEO_WIDTH = 8;
|
|
37
|
+
const DEFAULT_VIDEO_HEIGHT = 8;
|
|
38
38
|
const localVideoBuffer = {
|
|
39
39
|
userId: '',
|
|
40
40
|
buffer: null,
|
|
@@ -420,8 +420,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
420
420
|
case 'onSystemAudioLoopbackError':
|
|
421
421
|
this.handleOnSystemAudioLoopbackError(int32_1);
|
|
422
422
|
break;
|
|
423
|
-
case 'onVideoSizeChange':
|
|
424
|
-
this.handleOnVideoSizeChange(string_1, int32_1, int32_2, int32_3);
|
|
425
423
|
default:
|
|
426
424
|
break;
|
|
427
425
|
}
|
|
@@ -1084,7 +1082,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1084
1082
|
handleOnScreenCaptureStarted() {
|
|
1085
1083
|
console.debug('trtc:onScreenCaptureStarted');
|
|
1086
1084
|
this.isScreenCapturing = true;
|
|
1087
|
-
// 只有在 Buffer 为 null 时才新建,否则只能在
|
|
1085
|
+
// 只有在 Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1088
1086
|
if (!screenVideoBuffer.buffer) {
|
|
1089
1087
|
screenVideoBuffer.userId = '';
|
|
1090
1088
|
screenVideoBuffer.streamType = this.screenCaptureStreamType;
|
|
@@ -1220,7 +1218,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1220
1218
|
handleOnSystemAudioLoopbackError(errCode) {
|
|
1221
1219
|
this.fire('onSystemAudioLoopbackError', errCode);
|
|
1222
1220
|
}
|
|
1223
|
-
|
|
1221
|
+
handleVideoSizeChange(userId, streamType, width, height) {
|
|
1222
|
+
console.debug('trtc:handleVideoSizeChange', userId, streamType, width, height);
|
|
1224
1223
|
if (userId && userId !== CAMERA_DEVICE_TEST_ID) {
|
|
1225
1224
|
if (streamType !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub) {
|
|
1226
1225
|
const videoBufferInfo = remoteVideoBufferMap.get(userId);
|
|
@@ -1234,7 +1233,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1234
1233
|
}
|
|
1235
1234
|
}
|
|
1236
1235
|
else {
|
|
1237
|
-
console.error(`trtc:
|
|
1236
|
+
console.error(`trtc:handleVideoSizeChange error: ${userId} ${streamType} buffer not exist`);
|
|
1238
1237
|
}
|
|
1239
1238
|
}
|
|
1240
1239
|
else {
|
|
@@ -1648,8 +1647,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1648
1647
|
this._initRender(key, view);
|
|
1649
1648
|
}
|
|
1650
1649
|
// view 为 null 时,可能启动了自定义渲染,所以 Buffer 还是要创建,否则自定义渲染就拿不到数据;
|
|
1651
|
-
// view 非 null 时,当然必须创建 Buffer
|
|
1652
|
-
// 只有在 Buffer 为 null 时才新建,否则只能在
|
|
1650
|
+
// view 非 null 时,当然必须创建 Buffer
|
|
1651
|
+
// 只有在 Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1653
1652
|
if (!localVideoBuffer.buffer) {
|
|
1654
1653
|
localVideoBuffer.streamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
1655
1654
|
localVideoBuffer.buffer = (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength, localVideoBuffer.userId, localVideoBuffer.streamType);
|
|
@@ -1727,7 +1726,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1727
1726
|
this._initRender(key, view);
|
|
1728
1727
|
}
|
|
1729
1728
|
// view 为 null 时,可能启动了自定义渲染,所以 Buffer 还是要创建,否则自定义渲染就拿不到数据;
|
|
1730
|
-
// view 非 null 时,当然必须创建 Buffer
|
|
1729
|
+
// view 非 null 时,当然必须创建 Buffer
|
|
1731
1730
|
const videoBufferInfo = {
|
|
1732
1731
|
userId: userId,
|
|
1733
1732
|
buffer: (0, util_1.allocBuffer)(DEFAULT_VIDEO_WIDTH * DEFAULT_VIDEO_HEIGHT * this.pixelLength, userId, streamType),
|
|
@@ -1738,14 +1737,14 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1738
1737
|
};
|
|
1739
1738
|
if (streamType !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub) {
|
|
1740
1739
|
if (!remoteVideoBufferMap.get(userId)) {
|
|
1741
|
-
// Buffer 不存在时才新建,否则只能在
|
|
1740
|
+
// Buffer 不存在时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1742
1741
|
remoteVideoBufferMap.set(userId, videoBufferInfo);
|
|
1743
1742
|
this.rtcCloud.setRemoteVideoBuffer(userId, videoBufferInfo.buffer, videoBufferInfo.streamType, videoBufferInfo.width, videoBufferInfo.height, videoBufferInfo.pixelFormat);
|
|
1744
1743
|
}
|
|
1745
1744
|
}
|
|
1746
1745
|
else {
|
|
1747
1746
|
// 远端屏幕分享
|
|
1748
|
-
// Buffer 为 null 时才新建,否则只能在
|
|
1747
|
+
// Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
1749
1748
|
if (!screenVideoBuffer.buffer) {
|
|
1750
1749
|
Object.assign(screenVideoBuffer, videoBufferInfo);
|
|
1751
1750
|
this.rtcCloud.setSubVideoBuffer(screenVideoBuffer.userId, screenVideoBuffer.buffer, screenVideoBuffer.streamType, screenVideoBuffer.width, screenVideoBuffer.height, screenVideoBuffer.pixelFormat);
|
|
@@ -3315,12 +3314,12 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3315
3314
|
startCameraDeviceTest(view) {
|
|
3316
3315
|
if (view !== undefined) {
|
|
3317
3316
|
if (view !== null) {
|
|
3318
|
-
|
|
3317
|
+
const key = this.getKey(CAMERA_DEVICE_TEST_VIEW, trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
3319
3318
|
this._initRender(key, view);
|
|
3320
3319
|
const renderer = this.streams.get(key);
|
|
3321
3320
|
renderer.setContentMode(trtc_define_1.TRTCVideoFillMode.TRTCVideoFillMode_Fill);
|
|
3322
3321
|
}
|
|
3323
|
-
// Buffer 为 null 时才新建,否则只能在
|
|
3322
|
+
// Buffer 为 null 时才新建,否则只能在 handleVideoSizeChange 事件中重新申请 Buffer
|
|
3324
3323
|
if (!cameraTestVideoBuffer.buffer) {
|
|
3325
3324
|
const streamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
3326
3325
|
cameraTestVideoBuffer.streamType = streamType;
|
|
@@ -3330,9 +3329,14 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3330
3329
|
cameraTestVideoBuffer.height = DEFAULT_VIDEO_HEIGHT;
|
|
3331
3330
|
this.rtcCloud.setCameraTestVideoBuffer(cameraTestVideoBuffer.buffer, cameraTestVideoBuffer.width, cameraTestVideoBuffer.height, cameraTestVideoBuffer.pixelFormat);
|
|
3332
3331
|
}
|
|
3333
|
-
this.rtcCloud.startCameraDeviceTest((id, type, width, height, timestamp, rotation) => {
|
|
3332
|
+
this.rtcCloud.startCameraDeviceTest((id, type, width, height, timestamp, rotation, valid) => {
|
|
3334
3333
|
if (this.enableRenderFrame) {
|
|
3335
|
-
|
|
3334
|
+
if (valid === 1 && width === cameraTestVideoBuffer.width && height === cameraTestVideoBuffer.height) {
|
|
3335
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, cameraTestVideoBuffer.buffer);
|
|
3336
|
+
}
|
|
3337
|
+
else {
|
|
3338
|
+
this.handleVideoSizeChange(id, type, width, height);
|
|
3339
|
+
}
|
|
3336
3340
|
}
|
|
3337
3341
|
});
|
|
3338
3342
|
}
|
|
@@ -3363,9 +3367,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3363
3367
|
* 该方法测试麦克风是否能正常工作,volume 的取值范围为0 - 100。
|
|
3364
3368
|
*
|
|
3365
3369
|
* @param {Number} interval - 反馈音量提示的时间间隔(ms),建议设置到大于 200 毫秒
|
|
3370
|
+
* @param {Boolean} playback - 是否开启回播麦克风声音,开启后用户测试麦克风时会听到自己的声音。默认值 true
|
|
3366
3371
|
*/
|
|
3367
|
-
startMicDeviceTest(interval) {
|
|
3368
|
-
this.rtcCloud.startMicDeviceTest(interval);
|
|
3372
|
+
startMicDeviceTest(interval, playback = true) {
|
|
3373
|
+
this.rtcCloud.startMicDeviceTest(interval, playback);
|
|
3369
3374
|
}
|
|
3370
3375
|
/**
|
|
3371
3376
|
* 13.6 停止麦克风测试
|
|
@@ -3494,13 +3499,25 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3494
3499
|
console.error('trtc: not supported renderMode:', this.renderMode);
|
|
3495
3500
|
return;
|
|
3496
3501
|
}
|
|
3497
|
-
this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation) => {
|
|
3502
|
+
this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation, valid) => {
|
|
3498
3503
|
if (this.enableRenderFrame) {
|
|
3499
|
-
if (
|
|
3500
|
-
|
|
3504
|
+
if (valid === 1) {
|
|
3505
|
+
let targetBuffer;
|
|
3506
|
+
if (this.isScreenCapturing && this.screenCaptureStreamType === type) {
|
|
3507
|
+
targetBuffer = screenVideoBuffer;
|
|
3508
|
+
}
|
|
3509
|
+
else {
|
|
3510
|
+
targetBuffer = localVideoBuffer;
|
|
3511
|
+
}
|
|
3512
|
+
if (width === targetBuffer.width && height === targetBuffer.height) {
|
|
3513
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, targetBuffer.buffer);
|
|
3514
|
+
}
|
|
3515
|
+
else {
|
|
3516
|
+
this.handleVideoSizeChange(id, type, width, height);
|
|
3517
|
+
}
|
|
3501
3518
|
}
|
|
3502
3519
|
else {
|
|
3503
|
-
this.
|
|
3520
|
+
this.handleVideoSizeChange(id, type, width, height);
|
|
3504
3521
|
}
|
|
3505
3522
|
}
|
|
3506
3523
|
}, this.pixelformate);
|
|
@@ -3522,14 +3539,26 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3522
3539
|
console.error('trtc: not supported renderMode:', this.renderMode);
|
|
3523
3540
|
return;
|
|
3524
3541
|
}
|
|
3525
|
-
this.rtcCloud.addRemoteVideoRenderCallback(userId, (id, type, width, height, timestamp, rotation) => {
|
|
3542
|
+
this.rtcCloud.addRemoteVideoRenderCallback(userId, (id, type, width, height, timestamp, rotation, valid) => {
|
|
3526
3543
|
if (this.enableRenderFrame) {
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3544
|
+
if (valid === 1) {
|
|
3545
|
+
const videoBufferInfo = remoteVideoBufferMap.get(id);
|
|
3546
|
+
let targetBuffer;
|
|
3547
|
+
if (videoBufferInfo && videoBufferInfo.streamType === type) {
|
|
3548
|
+
targetBuffer = videoBufferInfo;
|
|
3549
|
+
}
|
|
3550
|
+
else {
|
|
3551
|
+
targetBuffer = screenVideoBuffer;
|
|
3552
|
+
}
|
|
3553
|
+
if (width === targetBuffer.width && height === targetBuffer.height) {
|
|
3554
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, targetBuffer.buffer);
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
this.handleVideoSizeChange(id, type, width, height);
|
|
3558
|
+
}
|
|
3530
3559
|
}
|
|
3531
3560
|
else {
|
|
3532
|
-
this.
|
|
3561
|
+
this.handleVideoSizeChange(id, type, width, height);
|
|
3533
3562
|
}
|
|
3534
3563
|
}
|
|
3535
3564
|
}, this.pixelformate);
|
|
@@ -3850,7 +3879,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3850
3879
|
renderer = new Render_1.default.RGBRenderer(); // RGBA32 Canvas 2D
|
|
3851
3880
|
}
|
|
3852
3881
|
else if (this.renderMode === 4) {
|
|
3853
|
-
renderer = new Render_1.default.Canvas3DRGBARenderer(); // RGBA canvas 3D
|
|
3882
|
+
renderer = new Render_1.default.Canvas3DRGBARenderer(); // RGBA canvas 3D
|
|
3854
3883
|
}
|
|
3855
3884
|
else if (this.renderMode === 5) {
|
|
3856
3885
|
renderer = new Render_1.default.I420VideoRenderer(); // I420 video(html)
|