trtc-electron-sdk 9.5.100-beta.0 → 9.5.112-beta.2

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.
@@ -31,7 +31,8 @@ const TrtcRender = function () {
31
31
  lastImageRotation: 0,
32
32
  lastIsNeedRotate: true,
33
33
  firstFrameRender: false,
34
- event: new EventEmitter()
34
+ event: new EventEmitter(),
35
+ fallbackCb: null,
35
36
  };
36
37
  that.getView = function () {
37
38
  return that.view;
@@ -40,8 +41,9 @@ const TrtcRender = function () {
40
41
  that.setContentMode = function (mode) {
41
42
  that.contentMode = mode;
42
43
  };
43
- that.bind = function (view) {
44
- initCanvas(view, that.mirrorView, view.clientWidth, view.clientHeight, that.initRotation, true, console.warn);
44
+ that.bind = function (view, fallbackCb) {
45
+ that.fallbackCb = fallbackCb;
46
+ initCanvas(view, that.mirrorView, view.clientWidth, view.clientHeight, that.initRotation, true, console.warn, true);
45
47
  };
46
48
  that.unbind = function () {
47
49
  try {
@@ -94,7 +96,7 @@ const TrtcRender = function () {
94
96
  that.unbind();
95
97
  initCanvas(view, image.mirror, image.width, image.height, image.rotation, image.isNeedRotate, e => {
96
98
  console.error(`init canvas ${image.width}*${image.height} rotation ${image.rotation} failed. ${e}`);
97
- });
99
+ }, false);
98
100
  }
99
101
  gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
100
102
  const xWidth = image.width + image.left + image.right;
@@ -239,7 +241,7 @@ const TrtcRender = function () {
239
241
  + ' b=y+2.017*u;'
240
242
  + ' gl_FragColor=vec4(r,g,b,1.0);'
241
243
  + '}';
242
- function initCanvas(view, mirror, width, height, rotation, isNeedRotate, onFailure) {
244
+ function initCanvas(view, mirror, width, height, rotation, isNeedRotate, onFailure, isBind) {
243
245
  that.clientWidth = view.clientWidth;
244
246
  that.clientHeight = view.clientHeight;
245
247
  that.view = view;
@@ -252,6 +254,11 @@ const TrtcRender = function () {
252
254
  that.container.style.alignItems = 'center';
253
255
  that.view.appendChild(that.container);
254
256
  that.canvas = document.createElement('canvas');
257
+ that.canvas.addEventListener('webglcontextlost', function (e) {
258
+ if (!isBind && that.fallbackCb) {
259
+ that.fallbackCb();
260
+ }
261
+ }, { once: true });
255
262
  if (isNeedKeepWidthAndHeight(rotation, isNeedRotate)) {
256
263
  that.canvas.width = width;
257
264
  that.canvas.height = height;
@@ -74,7 +74,6 @@ class Renderer {
74
74
  this.yuv = null;
75
75
  this.element = null;
76
76
  this.canvas = null;
77
- this.view = null;
78
77
  }
79
78
  refreshCanvas() {
80
79
  }
@@ -109,11 +108,49 @@ class Renderer {
109
108
  this.canvas.style.transform = 'rotateY(180deg)';
110
109
  }
111
110
  }
111
+ _adjustImageData(imageData) {
112
+ const { width, height, yUint8Array, uUint8Array, vUint8Array } = imageData;
113
+ const widthBase = 8;
114
+ const w8Modulo = width % widthBase;
115
+ if (w8Modulo !== 0) {
116
+ const newWidth = width - w8Modulo;
117
+ const newYSize = newWidth * height;
118
+ const newYArrayBuffer = new ArrayBuffer(newYSize);
119
+ const newYUint8Array = new Uint8Array(newYArrayBuffer);
120
+ let oldIndex = -1, newIndex = -1;
121
+ for (let h = 0; h < height; h += 1) {
122
+ for (let w = 0; w < newWidth; w += 1) {
123
+ oldIndex = width * h + w;
124
+ newIndex = newWidth * h + w;
125
+ newYUint8Array[newIndex] = yUint8Array[oldIndex];
126
+ }
127
+ }
128
+ const oldChromaWidth = width / 2;
129
+ const newChromaWidth = newWidth / 2;
130
+ const chromaHeight = height / 2;
131
+ const newChromaSize = newChromaWidth * chromaHeight;
132
+ const newUArrayBuffer = new ArrayBuffer(newChromaSize);
133
+ const newUInt8Array = new Uint8Array(newUArrayBuffer);
134
+ const newVArrayBuffer = new ArrayBuffer(newChromaSize);
135
+ const newVInt8Array = new Uint8Array(newVArrayBuffer);
136
+ for (let h = 0; h < chromaHeight; h += 1) {
137
+ for (let w = 0; w < newChromaWidth; w += 1) {
138
+ oldIndex = oldChromaWidth * h + w;
139
+ newIndex = newChromaWidth * h + w;
140
+ newUInt8Array[newIndex] = uUint8Array[oldIndex];
141
+ newVInt8Array[newIndex] = vUint8Array[oldIndex];
142
+ }
143
+ }
144
+ return Object.assign(Object.assign({}, imageData), { width: newWidth, height, yUint8Array: newYUint8Array, uUint8Array: newUInt8Array, vUint8Array: newVInt8Array });
145
+ }
146
+ return imageData;
147
+ }
112
148
  drawFrame(imageData) {
113
149
  if (!this.ready) {
114
150
  this.ready = true;
115
151
  this.event.emit('ready');
116
152
  }
153
+ imageData = this._adjustImageData(imageData);
117
154
  const mirror = 0;
118
155
  const contentWidth = imageData.width;
119
156
  const contentHeight = imageData.height;
@@ -2,7 +2,7 @@
2
2
  import { EventEmitter } from 'events';
3
3
  export interface IRenderer {
4
4
  event: EventEmitter;
5
- bind(element: Element): void;
5
+ bind(element: Element, fallbackCb?: () => void): void;
6
6
  unbind(): void;
7
7
  drawFrame(imageData: {
8
8
  header: any;
@@ -18,7 +18,7 @@ declare class GlRenderer implements IRenderer {
18
18
  self: any;
19
19
  event: EventEmitter;
20
20
  constructor();
21
- bind(element: Element): void;
21
+ bind(element: Element, fallbackCb?: () => void): void;
22
22
  unbind(): void;
23
23
  drawFrame(imageData: {
24
24
  header: any;
@@ -15,8 +15,8 @@ class GlRenderer {
15
15
  this.self = GlRenderer_1.default.apply(this);
16
16
  this.event = this.self.event;
17
17
  }
18
- bind(element) {
19
- return this.self.bind(element);
18
+ bind(element, fallbackCb) {
19
+ return this.self.bind(element, fallbackCb);
20
20
  }
21
21
  unbind() {
22
22
  return this.self.unbind();
package/liteav/trtc.d.ts CHANGED
@@ -39,6 +39,7 @@ declare class TRTCCloud extends EventEmitter {
39
39
  private audioQuality;
40
40
  private bgmId;
41
41
  private playAudioEffectIdList;
42
+ private enableRenderFrame;
42
43
  constructor();
43
44
  /**
44
45
  * 创建 TRTCCloud 对象单例
@@ -1493,6 +1494,29 @@ declare class TRTCCloud extends EventEmitter {
1493
1494
  * @param {Number} volume - 设置的混音音量大小,范围0 - 100
1494
1495
  */
1495
1496
  setSubStreamMixVolume(volume: number): void;
1497
+ /**
1498
+ * 8.13 将指定窗口加入屏幕分享的排除列表中,加入排除列表中的窗口不会被分享出去
1499
+ *
1500
+ * 支持启动屏幕分享前设置过滤窗口,也支持屏幕分享过程中动态添加过滤窗口。
1501
+ *
1502
+ * @param {String} win - 不希望分享出去的窗口
1503
+ * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
1504
+ * - Windows下该方法添加的窗口列表会在退房后清空;Mac下在退出房间时不会自动清空,需要调用一次removeAllExcludedShareWindow()方法清空列表。
1505
+ */
1506
+ addExcludedShareWindow(win: string): void;
1507
+ /**
1508
+ * 8.14 将指定窗口从屏幕分享的排除列表中移除
1509
+ *
1510
+ * @param {String} win - 不希望分享出去的窗口
1511
+ * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
1512
+ */
1513
+ removeExcludedShareWindow(win: string): void;
1514
+ /**
1515
+ * 8.15 将所有窗口从屏幕分享的排除列表中移除
1516
+ *
1517
+ * @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
1518
+ */
1519
+ removeAllExcludedShareWindow(): void;
1496
1520
  /**
1497
1521
  * @private
1498
1522
  * 9.5 设置本地视频自定义渲染(Electron 平台下不可用)
@@ -1746,13 +1770,6 @@ declare class TRTCCloud extends EventEmitter {
1746
1770
  * @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 100;默认值:100
1747
1771
  */
1748
1772
  setMusicPublishVolume(id: number, volume: number): void;
1749
- /**
1750
- * 11.22 调整背景音乐的变速效果
1751
- *
1752
- * @param {Number} id - 音乐 ID
1753
- * @param {Number} speedRate - 速度,默认值是1.0f,范围是:[0.5 ~ 2] 之间的浮点数;
1754
- */
1755
- setMusicSpeedRate(id: number, speedRate: number): void;
1756
1773
  /**
1757
1774
  * 12.1 废弃接口: 播放音效
1758
1775
  *
@@ -1959,7 +1976,9 @@ declare class TRTCCloud extends EventEmitter {
1959
1976
  removePlugin(id: string): void;
1960
1977
  getPluginList(): PluginInfo[];
1961
1978
  createPlugin(pluginId: string): PluginInfo;
1979
+ setPluginCallback(pluginCb: (pluginId: string, errorCode: number, msg: string) => void): void;
1962
1980
  getKey(uid: string, type: TRTCVideoStreamType): string;
1981
+ setEnableRenderFrame(enable: boolean): void;
1963
1982
  /**
1964
1983
  * 判断是否支持webGL
1965
1984
  * @returns {boolean}
package/liteav/trtc.js CHANGED
@@ -31,6 +31,7 @@ __exportStar(require("./trtc_define"), exports);
31
31
  __exportStar(require("./trtc_code"), exports);
32
32
  // 监听该事件,返回自定义视频渲染数据 ( bgra 格式)
33
33
  const CUSTOM_VIDEO_DATA = 'onVideoData';
34
+ const SDK_LOG_LEVEL = 2;
34
35
  let genSecFunc = function (instance, key) {
35
36
  return function () {
36
37
  let param = Array.from(arguments);
@@ -66,7 +67,20 @@ let secMethods = function (instance) {
66
67
  copyMethods(instance);
67
68
  copyPropMethods(instance);
68
69
  };
70
+ let formatLogParams = function (params) {
71
+ let logParamsStr = '';
72
+ let paramsKeyList = Object.keys(params);
73
+ for (let i = 0; i < paramsKeyList.length; i++) {
74
+ const paramKey = paramsKeyList[i];
75
+ logParamsStr += `${paramKey}:${params[paramKey]}`;
76
+ if (i !== paramsKeyList.length - 1) {
77
+ logParamsStr += ',';
78
+ }
79
+ }
80
+ return logParamsStr;
81
+ };
69
82
  let trtcCloudInstance = null;
83
+ let oriRtcCloud = null;
70
84
  /**
71
85
  * 腾讯云视频通话功能的主要接口类
72
86
  *
@@ -82,7 +96,10 @@ let trtcCloudInstance = null;
82
96
  class TRTCCloud extends events_1.EventEmitter {
83
97
  constructor() {
84
98
  super();
85
- this.rtcCloud = new trtc.NodeRTCCloud(pkg.version);
99
+ oriRtcCloud = new trtc.NodeRTCCloud(pkg.version);
100
+ this.rtcCloud = Object.assign({}, oriRtcCloud, {
101
+ onlineLog: undefined
102
+ });
86
103
  this.streams = new Map();
87
104
  this.firstVideoFrameList = [];
88
105
  this.playStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
@@ -103,6 +120,7 @@ class TRTCCloud extends events_1.EventEmitter {
103
120
  // 生成一个足够大, 不会与用户输入重复的 id
104
121
  this.bgmId = 1 << 29;
105
122
  this.playAudioEffectIdList = [];
123
+ this.enableRenderFrame = true;
106
124
  this.initEventHandler();
107
125
  console.log('constructor render:' + this.renderMode + '|sdk version:' + pkg.version +
108
126
  '|native sdk version:' + this.rtcCloud.getSDKVersion());
@@ -383,6 +401,13 @@ class TRTCCloud extends events_1.EventEmitter {
383
401
  */
384
402
  handleOnEnterRoom(result) {
385
403
  this.fire('onEnterRoom', result);
404
+ const params = {
405
+ js_version: pkg.version,
406
+ electron_version: process && process.versions && process.versions.electron || '',
407
+ arch: process && process.arch || '',
408
+ ua: window.navigator.userAgent
409
+ };
410
+ oriRtcCloud.onlineLog(result, SDK_LOG_LEVEL, '[trtc-electron-sdk] trtcstats', formatLogParams(params));
386
411
  }
387
412
  /**
388
413
  * 2.2 退出房间的事件回调
@@ -480,15 +505,15 @@ class TRTCCloud extends events_1.EventEmitter {
480
505
  * @param {Number} reason - 离开原因,0表示用户主动退出房间,1表示用户超时退出,2表示被踢出房间。
481
506
  */
482
507
  handleOnRemoteUserLeaveRoom(userId, reason) {
483
- // const streamTypeList = [
484
- // TRTCVideoStreamType.TRTCVideoStreamTypeBig,
485
- // TRTCVideoStreamType.TRTCVideoStreamTypeSub,
486
- // TRTCVideoStreamType.TRTCVideoStreamTypeSmall
487
- // ];
488
- // streamTypeList.forEach(streamType => {
489
- // const key = this.getKey(userId, streamType);
490
- // this._destroyRender(key, null);
491
- // });
508
+ const streamTypeList = [
509
+ trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
510
+ trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub,
511
+ trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSmall
512
+ ];
513
+ streamTypeList.forEach(streamType => {
514
+ const key = this.getKey(userId, streamType);
515
+ this._destroyRender(key, null);
516
+ });
492
517
  this.fire('onRemoteUserLeaveRoom', userId, reason);
493
518
  }
494
519
  /**
@@ -1447,7 +1472,13 @@ class TRTCCloud extends events_1.EventEmitter {
1447
1472
  }
1448
1473
  if (view !== undefined) {
1449
1474
  if (view !== null) {
1450
- const key = this.getKey(userId, streamType);
1475
+ let bindStreamType = streamType;
1476
+ if (bindStreamType === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSmall) {
1477
+ // 如果拉取小流, 绑定 render 时也采用大流, 防止大小流切换后无法找到对应 render 进行渲染
1478
+ // 这里的逻辑和 _onRenderFrame 里, 获取 render 是不论小流还是大流, 都采用大流取获取 render 有关
1479
+ bindStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
1480
+ }
1481
+ const key = this.getKey(userId, bindStreamType);
1451
1482
  this._initRender(key, view);
1452
1483
  }
1453
1484
  this.addRemoteVideoRenderCallback(userId);
@@ -2369,6 +2400,35 @@ class TRTCCloud extends events_1.EventEmitter {
2369
2400
  setSubStreamMixVolume(volume) {
2370
2401
  this.rtcCloud.setSubStreamMixVolume(volume);
2371
2402
  }
2403
+ /**
2404
+ * 8.13 将指定窗口加入屏幕分享的排除列表中,加入排除列表中的窗口不会被分享出去
2405
+ *
2406
+ * 支持启动屏幕分享前设置过滤窗口,也支持屏幕分享过程中动态添加过滤窗口。
2407
+ *
2408
+ * @param {String} win - 不希望分享出去的窗口
2409
+ * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
2410
+ * - Windows下该方法添加的窗口列表会在退房后清空;Mac下在退出房间时不会自动清空,需要调用一次removeAllExcludedShareWindow()方法清空列表。
2411
+ */
2412
+ addExcludedShareWindow(win) {
2413
+ this.rtcCloud.addExcludedShareWindow(win);
2414
+ }
2415
+ /**
2416
+ * 8.14 将指定窗口从屏幕分享的排除列表中移除
2417
+ *
2418
+ * @param {String} win - 不希望分享出去的窗口
2419
+ * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
2420
+ */
2421
+ removeExcludedShareWindow(win) {
2422
+ this.rtcCloud.removeExcludedShareWindow(win);
2423
+ }
2424
+ /**
2425
+ * 8.15 将所有窗口从屏幕分享的排除列表中移除
2426
+ *
2427
+ * @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
2428
+ */
2429
+ removeAllExcludedShareWindow() {
2430
+ this.rtcCloud.removeAllExcludedShareWindow();
2431
+ }
2372
2432
  /////////////////////////////////////////////////////////////////////////////////
2373
2433
  //
2374
2434
  // (九)自定义采集和渲染
@@ -2747,15 +2807,6 @@ class TRTCCloud extends events_1.EventEmitter {
2747
2807
  setMusicPublishVolume(id, volume) {
2748
2808
  this.rtcCloud.setMusicPublishVolume(id, volume);
2749
2809
  }
2750
- /**
2751
- * 11.22 调整背景音乐的变速效果
2752
- *
2753
- * @param {Number} id - 音乐 ID
2754
- * @param {Number} speedRate - 速度,默认值是1.0f,范围是:[0.5 ~ 2] 之间的浮点数;
2755
- */
2756
- setMusicSpeedRate(id, speedRate) {
2757
- this.rtcCloud.setMusicSpeedRate(id, speedRate);
2758
- }
2759
2810
  /////////////////////////////////////////////////////////////////////////////////
2760
2811
  //
2761
2812
  // (十二)音效相关接口函数
@@ -2909,6 +2960,9 @@ class TRTCCloud extends events_1.EventEmitter {
2909
2960
  let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2910
2961
  this._destroyRender(key, null);
2911
2962
  this.rtcCloud.stopCameraDeviceTest();
2963
+ this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
2964
+ return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2965
+ });
2912
2966
  }
2913
2967
  /**
2914
2968
  * 13.5 开始进行麦克风测试
@@ -3049,7 +3103,9 @@ class TRTCCloud extends events_1.EventEmitter {
3049
3103
  this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
3050
3104
  }
3051
3105
  this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation, data) => {
3052
- this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3106
+ if (this.enableRenderFrame) {
3107
+ this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3108
+ }
3053
3109
  }, this.pixelformate);
3054
3110
  }
3055
3111
  addRemoteVideoRenderCallback(userid) {
@@ -3060,7 +3116,9 @@ class TRTCCloud extends events_1.EventEmitter {
3060
3116
  this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
3061
3117
  }
3062
3118
  this.rtcCloud.addRemoteVideoRenderCallback(userid, (id, type, width, height, timestamp, rotation, data) => {
3063
- this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3119
+ if (this.enableRenderFrame) {
3120
+ this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3121
+ }
3064
3122
  }, this.pixelformate);
3065
3123
  }
3066
3124
  //----------------------------------//
@@ -3125,9 +3183,16 @@ class TRTCCloud extends events_1.EventEmitter {
3125
3183
  }
3126
3184
  };
3127
3185
  }
3186
+ setPluginCallback(pluginCb) {
3187
+ this.rtcCloud.setPluginCallback(pluginCb);
3188
+ }
3128
3189
  getKey(uid, type) {
3129
3190
  return String(uid) + '_' + String(type);
3130
3191
  }
3192
+ setEnableRenderFrame(enable) {
3193
+ console.log('setEnableRenderFrame:' + enable);
3194
+ this.enableRenderFrame = enable;
3195
+ }
3131
3196
  /**
3132
3197
  * 判断是否支持webGL
3133
3198
  * @returns {boolean}
@@ -3215,6 +3280,9 @@ class TRTCCloud extends events_1.EventEmitter {
3215
3280
  });
3216
3281
  // 画面不区分大小流,只区分主流和辅流(屏幕分享),这里统一使用主流当做 key
3217
3282
  let streamType = type;
3283
+ if (streamType === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSmall) {
3284
+ streamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
3285
+ }
3218
3286
  this._onRealRender(uid, streamType, width, height, timestamp, rotation, data);
3219
3287
  }
3220
3288
  //回调远程给用户数据
@@ -3254,7 +3322,7 @@ class TRTCCloud extends events_1.EventEmitter {
3254
3322
  let ulen = width * height / 4;
3255
3323
  let ydata = new Uint8Array(data, 0, ylen);
3256
3324
  let udata = new Uint8Array(data, ylen, ulen);
3257
- let vdata = new Uint8Array(data, ylen + ulen, data.le);
3325
+ let vdata = new Uint8Array(data, ylen + ulen, ulen);
3258
3326
  renderer.drawFrame({
3259
3327
  width: width,
3260
3328
  height: height,
@@ -3289,7 +3357,14 @@ class TRTCCloud extends events_1.EventEmitter {
3289
3357
  renderer = new Render_1.default.GlRenderer();
3290
3358
  }
3291
3359
  view.innerHTML = ''; // 事先清空一下,避免画面叠加
3292
- renderer.bind(view);
3360
+ if (this.renderMode === 1) {
3361
+ renderer.bind(view, () => {
3362
+ this.setRenderMode(2);
3363
+ });
3364
+ }
3365
+ else {
3366
+ renderer.bind(view);
3367
+ }
3293
3368
  this.streams.set(String(key), renderer);
3294
3369
  if (key === this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig)) {
3295
3370
  // 只有本地视频, 才设置 local fill mode
@@ -119,7 +119,7 @@ export declare class TRTCImageBuffer {
119
119
  length: number;
120
120
  width: number;
121
121
  height: number;
122
- constructor();
122
+ constructor(buffer?: ArrayBuffer, length?: number, width?: number, height?: number);
123
123
  }
124
124
  /**
125
125
  * 3.5 屏幕采集源信息
@@ -129,6 +129,7 @@ export declare class TRTCImageBuffer {
129
129
  * @param {String} sourceName - 采集源名称,UTF8编码
130
130
  * @param {TRTCImageBuffer} thumbBGRA - 缩略图内容
131
131
  * @param {TRTCImageBuffer} iconBGRA - 图标内容
132
+ * @param {Boolean} isMinimizeWindow - 是否最小化窗口
132
133
  *
133
134
  */
134
135
  export declare class TRTCScreenCaptureSourceInfo {
@@ -137,7 +138,8 @@ export declare class TRTCScreenCaptureSourceInfo {
137
138
  sourceName: string;
138
139
  thumbBGRA: TRTCImageBuffer;
139
140
  iconBGRA: TRTCImageBuffer;
140
- constructor();
141
+ isMinimizeWindow: boolean;
142
+ constructor(type?: TRTCScreenCaptureSourceType, sourceId?: string, sourceName?: string, thumbBGRA?: TRTCImageBuffer, iconBGRA?: TRTCImageBuffer, isMinimizeWindow?: boolean);
141
143
  }
142
144
  /**
143
145
  * 3.6 设备信息
@@ -149,7 +151,7 @@ export declare class TRTCScreenCaptureSourceInfo {
149
151
  export declare class TRTCDeviceInfo {
150
152
  deviceId: string;
151
153
  deviceName: string;
152
- constructor();
154
+ constructor(deviceId?: string, deviceName?: string);
153
155
  }
154
156
  /**
155
157
  * 3.7 视频帧数据
@@ -175,7 +177,7 @@ export declare class TRTCVideoFrame {
175
177
  height: number;
176
178
  timestamp: number;
177
179
  rotation: number;
178
- constructor();
180
+ constructor(videoFormat?: TRTCVideoPixelFormat, bufferType?: TRTCVideoBufferType, data?: null | ArrayBuffer, textureId?: number, length?: number, width?: number, height?: number, timestamp?: number, rotation?: number);
179
181
  }
180
182
  export declare enum TRTCLogLevel {
181
183
  TRTCLogLevelNone = 0,
@@ -213,8 +215,10 @@ export declare enum TRTCWaterMarkSrcType {
213
215
  * 【推荐取值】如果一个用户在您的账号系统中的 ID 为“abc”,则 userId 即可设置为“abc”。<br>
214
216
  * @param {String} userSig - 【字段含义】用户签名(必填),当前 userId 对应的验证签名,相当于登录密码。<br>
215
217
  * 【推荐取值】请参考 [如何计算UserSig](https://cloud.tencent.com/document/product/647/17275)。<br>
216
- * @param {Number} roomId - 【字段含义】房间号码(必填),指定房间号,在同一个房间里的用户(userId)可以彼此看到对方并进行视频通话。<br>
218
+ * @param {Number} roomId - 【字段含义】房间号码(必填),指定房间号,在同一个房间里的用户(userId)可以彼此看到对方并进行视频通话, roomId 和 strRoomId 必须填一个, 若您选用 strRoomId,则 roomId 需要填写为0。<br>
217
219
  * 【推荐取值】您可以随意指定,但请不要重复,如果您的用户账号 ID 是数字类型的,可以直接用创建者的用户 ID 作为 roomId。<br>
220
+ * @param {String} strRoomId - 【字段含义】字符串房间号码(选填),roomId 和 strRoomId 必须填一个。若两者都填,则优先选择 roomId。<br>
221
+ * 【推荐取值】您可以随意指定,但请不要重复。<br>
218
222
  * @param {TRTCRoleType} role - 【字段含义】直播场景下的角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom),视频通话场景下指定无效。<br>
219
223
  * 【推荐取值】默认值:主播(TRTCRoleAnchor)<br>
220
224
  * @param {String} privateMapKey - 【字段含义】房间签名(非必填),如果您希望某个房间只能让特定的某些 userId 进入,就需要使用 privateMapKey 进行权限保护。<br>
@@ -231,8 +235,8 @@ export declare enum TRTCWaterMarkSrcType {
231
235
  */
232
236
  export declare class TRTCParams {
233
237
  sdkAppId: number;
234
- userId: null | string;
235
- userSig: null | string;
238
+ userId: string;
239
+ userSig: string;
236
240
  roomId: number;
237
241
  strRoomId: string;
238
242
  role: number;
@@ -240,7 +244,7 @@ export declare class TRTCParams {
240
244
  businessInfo: null | string;
241
245
  streamId: null | string;
242
246
  userDefineRecordId: null | string;
243
- constructor();
247
+ constructor(sdkAppId?: number, userId?: string, userSig?: string, roomId?: number, strRoomId?: string, role?: TRTCRoleType, privateMapKey?: null | string, businessInfo?: null | string, streamId?: null | string, userDefineRecordId?: null | string);
244
248
  }
245
249
  /**
246
250
  * 5.2 视频编码参数
@@ -281,12 +285,12 @@ export declare class TRTCParams {
281
285
  */
282
286
  export declare class TRTCVideoEncParam {
283
287
  videoResolution: TRTCVideoResolution;
284
- resMode: number;
288
+ resMode: TRTCVideoResolutionMode;
285
289
  videoFps: number;
286
290
  videoBitrate: number;
287
291
  minVideoBitrate: number;
288
292
  enableAdjustRes: boolean;
289
- constructor();
293
+ constructor(videoResolution?: TRTCVideoResolution, resMode?: TRTCVideoResolutionMode, videoFps?: number, videoBitrate?: number, minVideoBitrate?: number, enableAdjustRes?: boolean);
290
294
  }
291
295
  /**
292
296
  * 5.3 画面渲染参数
@@ -302,7 +306,7 @@ export declare class TRTCRenderParams {
302
306
  rotation: TRTCVideoRotation;
303
307
  fillMode: TRTCVideoFillMode;
304
308
  mirrorType: TRTCVideoMirrorType;
305
- constructor();
309
+ constructor(rotation?: TRTCVideoRotation, fillMode?: TRTCVideoFillMode, mirrorType?: TRTCVideoMirrorType);
306
310
  }
307
311
  /**
308
312
  * 5.4 网络流控相关参数
@@ -321,9 +325,9 @@ export declare class TRTCRenderParams {
321
325
  *
322
326
  */
323
327
  export declare class TRTCNetworkQosParam {
324
- preference: number;
325
- controlMode: number;
326
- constructor();
328
+ preference: TRTCVideoQosPreference;
329
+ controlMode: TRTCQosControlMode;
330
+ constructor(preference?: TRTCVideoQosPreference, controlMode?: TRTCQosControlMode);
327
331
  }
328
332
  /**
329
333
  * 5.5 视频质量
@@ -335,9 +339,9 @@ export declare class TRTCNetworkQosParam {
335
339
  *
336
340
  */
337
341
  export declare class TRTCQualityInfo {
338
- userId: null | string;
342
+ userId: string;
339
343
  quality: TRTCQuality;
340
- constructor();
344
+ constructor(userId?: string, quality?: TRTCQuality);
341
345
  }
342
346
  /**
343
347
  * 5.6 音量大小
@@ -349,9 +353,9 @@ export declare class TRTCQualityInfo {
349
353
  *
350
354
  */
351
355
  export declare class TRTCVolumeInfo {
352
- userId: null | string;
356
+ userId: string;
353
357
  volume: number;
354
- constructor();
358
+ constructor(userId?: string, volume?: number);
355
359
  }
356
360
  /**
357
361
  * 5.8 网络测速结果
@@ -373,12 +377,12 @@ export declare class TRTCVolumeInfo {
373
377
  *
374
378
  */
375
379
  export declare class TRTCSpeedTestResult {
376
- ip: null | string;
377
- quality: number;
380
+ ip: string;
381
+ quality: TRTCQuality;
378
382
  upLostRate: number;
379
383
  downLostRate: number;
380
384
  rtt: number;
381
- constructor();
385
+ constructor(ip?: string, quality?: TRTCQuality, upLostRate?: number, downLostRate?: number, rtt?: number);
382
386
  }
383
387
  /**
384
388
  * 记录矩形的四个点坐标
@@ -419,8 +423,8 @@ export declare class TRTCMixUser {
419
423
  rect: null | Rect;
420
424
  zOrder: number;
421
425
  pureAudio: boolean;
422
- streamType: number;
423
- constructor();
426
+ streamType: TRTCVideoStreamType;
427
+ constructor(userId?: string, roomId?: string, rect?: null | Rect, zOrder?: number, pureAudio?: boolean, streamType?: TRTCVideoStreamType);
424
428
  }
425
429
  export declare enum TRTCTranscodingConfigMode {
426
430
  TRTCTranscodingConfigMode_Unknown = 0,
@@ -474,7 +478,7 @@ export declare enum TRTCTranscodingConfigMode {
474
478
  * 【推荐取值】默认值:'',即房间里的多路流会混合到该接口调用者的视频流上。
475
479
  */
476
480
  export declare class TRTCTranscodingConfig {
477
- mode: number;
481
+ mode: TRTCTranscodingConfigMode;
478
482
  appId: number;
479
483
  bizId: number;
480
484
  videoWidth: number;
@@ -482,14 +486,14 @@ export declare class TRTCTranscodingConfig {
482
486
  videoBitrate: number;
483
487
  videoFramerate: number;
484
488
  videoGOP: number;
489
+ backgroundColor: number;
490
+ backgroundImage: string;
485
491
  audioSampleRate: number;
486
492
  audioBitrate: number;
487
493
  audioChannels: number;
488
494
  mixUsersArray: TRTCMixUser[];
489
- backgroundColor: number;
490
- backgroundImage: string;
491
495
  streamId: string;
492
- constructor();
496
+ constructor(mode?: TRTCTranscodingConfigMode, appId?: number, bizId?: number, videoWidth?: number, videoHeight?: number, videoBitrate?: number, videoFramerate?: number, videoGOP?: number, backgroundColor?: number, backgroundImage?: string, audioSampleRate?: number, audioBitrate?: number, audioChannels?: number, mixUsersArray?: any[], streamId?: string);
493
497
  }
494
498
  /**
495
499
  * 5.12 CDN 旁路推流参数
@@ -503,7 +507,7 @@ export declare class TRTCPublishCDNParam {
503
507
  appId: number;
504
508
  bizId: number;
505
509
  url: null | string;
506
- constructor();
510
+ constructor(appId?: number, bizId?: number, url?: null | string);
507
511
  }
508
512
  /**
509
513
  * 5.13 录音参数
@@ -516,7 +520,7 @@ export declare class TRTCPublishCDNParam {
516
520
  */
517
521
  export declare class TRTCAudioRecordingParams {
518
522
  filePath: null | string;
519
- constructor();
523
+ constructor(filePath?: null | string);
520
524
  }
521
525
  /**
522
526
  * 5.14 音效
@@ -537,7 +541,7 @@ export declare class TRTCAudioEffectParam {
537
541
  loopCount: number;
538
542
  publish: boolean;
539
543
  volume: number;
540
- constructor();
544
+ constructor(effectId?: number, path?: string, loopCount?: number, publish?: boolean, volume?: number);
541
545
  }
542
546
  /**
543
547
  * 本地的音视频统计信息
@@ -558,8 +562,8 @@ export declare class TRTCLocalStatistics {
558
562
  videoBitrate: number;
559
563
  audioSampleRate: number;
560
564
  audioBitrate: number;
561
- streamType: number;
562
- constructor();
565
+ streamType: TRTCVideoStreamType;
566
+ constructor(width?: number, height?: number, frameRate?: number, videoBitrate?: number, audioSampleRate?: number, audioBitrate?: number, streamType?: TRTCVideoStreamType);
563
567
  }
564
568
  /**
565
569
  * 远端成员的音视频统计信息
@@ -597,8 +601,8 @@ export declare class TRTCRemoteStatistics {
597
601
  audioBlockRate: number;
598
602
  videoTotalBlockTime: number;
599
603
  videoBlockRate: number;
600
- streamType: number;
601
- constructor();
604
+ streamType: TRTCVideoStreamType;
605
+ constructor(userId?: string, finalLoss?: number, width?: number, height?: number, frameRate?: number, videoBitrate?: number, audioSampleRate?: number, audioBitrate?: number, jitterBufferDelay?: number, audioTotalBlockTime?: number, audioBlockRate?: number, videoTotalBlockTime?: number, videoBlockRate?: number, streamType?: TRTCVideoStreamType);
602
606
  }
603
607
  /**
604
608
  * 统计数据
@@ -612,9 +616,6 @@ export declare class TRTCRemoteStatistics {
612
616
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
613
617
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
614
618
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
615
- * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
616
- * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
617
- * 当网络为蜂窝网非 WiFi 类型时,该值无效。
618
619
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
619
620
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
620
621
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -629,14 +630,13 @@ export declare class TRTCStatistics {
629
630
  appCpu: number;
630
631
  systemCpu: number;
631
632
  rtt: number;
632
- gatewayRtt: number;
633
633
  receivedBytes: number;
634
634
  sentBytes: number;
635
- localStatisticsArray: null | TRTCLocalStatistics[];
635
+ localStatisticsArray: TRTCLocalStatistics[];
636
636
  localStatisticsArraySize: number;
637
637
  remoteStatisticsArray: TRTCRemoteStatistics[];
638
638
  remoteStatisticsArraySize: number;
639
- constructor();
639
+ constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number);
640
640
  }
641
641
  /**
642
642
  * 音乐参数
@@ -658,7 +658,7 @@ export declare class AudioMusicParam {
658
658
  isShortFile: boolean;
659
659
  startTimeMS: number;
660
660
  endTimeMS: number;
661
- constructor();
661
+ constructor(id?: number, path?: string, loopCount?: number, publish?: boolean, isShortFile?: boolean, startTimeMS?: number, endTimeMS?: number);
662
662
  }
663
663
  /**
664
664
  * 房间切换参数
@@ -675,7 +675,7 @@ export declare class TRTCSwitchRoomParam {
675
675
  strRoomId: string;
676
676
  userSig: string;
677
677
  privateMapKey: string;
678
- constructor();
678
+ constructor(roomId?: number, strRoomId?: string, userSig?: string, privateMapKey?: string);
679
679
  }
680
680
  export interface VideoFramePayload {
681
681
  uid: string;
@@ -506,11 +506,11 @@ var TRTCAudioQuality;
506
506
  *
507
507
  */
508
508
  class TRTCImageBuffer {
509
- constructor() {
510
- this.buffer = new ArrayBuffer(0);
511
- this.length = 0;
512
- this.width = 0;
513
- this.height = 0;
509
+ constructor(buffer = new ArrayBuffer(0), length = 0, width = 0, height = 0) {
510
+ this.buffer = buffer;
511
+ this.length = length;
512
+ this.width = width;
513
+ this.height = height;
514
514
  }
515
515
  }
516
516
  exports.TRTCImageBuffer = TRTCImageBuffer;
@@ -523,15 +523,17 @@ exports.TRTCImageBuffer = TRTCImageBuffer;
523
523
  * @param {String} sourceName - 采集源名称,UTF8编码
524
524
  * @param {TRTCImageBuffer} thumbBGRA - 缩略图内容
525
525
  * @param {TRTCImageBuffer} iconBGRA - 图标内容
526
+ * @param {Boolean} isMinimizeWindow - 是否最小化窗口
526
527
  *
527
528
  */
528
529
  class TRTCScreenCaptureSourceInfo {
529
- constructor() {
530
- this.type = TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown;
531
- this.sourceId = '';
532
- this.sourceName = '';
533
- this.thumbBGRA = new TRTCImageBuffer();
534
- this.iconBGRA = new TRTCImageBuffer();
530
+ constructor(type = TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown, sourceId = '', sourceName = '', thumbBGRA = new TRTCImageBuffer(), iconBGRA = new TRTCImageBuffer(), isMinimizeWindow = false) {
531
+ this.type = type;
532
+ this.sourceId = sourceId;
533
+ this.sourceName = sourceName;
534
+ this.thumbBGRA = thumbBGRA;
535
+ this.iconBGRA = iconBGRA;
536
+ this.isMinimizeWindow = isMinimizeWindow;
535
537
  }
536
538
  }
537
539
  exports.TRTCScreenCaptureSourceInfo = TRTCScreenCaptureSourceInfo;
@@ -544,9 +546,9 @@ exports.TRTCScreenCaptureSourceInfo = TRTCScreenCaptureSourceInfo;
544
546
  *
545
547
  */
546
548
  class TRTCDeviceInfo {
547
- constructor() {
548
- this.deviceId = '';
549
- this.deviceName = '';
549
+ constructor(deviceId = '', deviceName = '') {
550
+ this.deviceId = deviceId;
551
+ this.deviceName = deviceName;
550
552
  }
551
553
  }
552
554
  exports.TRTCDeviceInfo = TRTCDeviceInfo;
@@ -566,16 +568,16 @@ exports.TRTCDeviceInfo = TRTCDeviceInfo;
566
568
  *
567
569
  */
568
570
  class TRTCVideoFrame {
569
- constructor() {
570
- this.videoFormat = TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown;
571
- this.bufferType = TRTCVideoBufferType.TRTCVideoBufferType_Unknown;
572
- this.data = null;
573
- this.textureId = 0;
574
- this.length = 0;
575
- this.width = 0;
576
- this.height = 0;
577
- this.timestamp = 0;
578
- this.rotation = 0;
571
+ constructor(videoFormat = TRTCVideoPixelFormat.TRTCVideoPixelFormat_Unknown, bufferType = TRTCVideoBufferType.TRTCVideoBufferType_Unknown, data = null, textureId = 0, length = 0, width = 0, height = 0, timestamp = 0, rotation = 0) {
572
+ this.videoFormat = videoFormat;
573
+ this.bufferType = bufferType;
574
+ this.data = data;
575
+ this.textureId = textureId;
576
+ this.length = length;
577
+ this.width = width;
578
+ this.height = height;
579
+ this.timestamp = timestamp;
580
+ this.rotation = rotation;
579
581
  }
580
582
  }
581
583
  exports.TRTCVideoFrame = TRTCVideoFrame;
@@ -700,8 +702,10 @@ var TRTCWaterMarkSrcType;
700
702
  * 【推荐取值】如果一个用户在您的账号系统中的 ID 为“abc”,则 userId 即可设置为“abc”。<br>
701
703
  * @param {String} userSig - 【字段含义】用户签名(必填),当前 userId 对应的验证签名,相当于登录密码。<br>
702
704
  * 【推荐取值】请参考 [如何计算UserSig](https://cloud.tencent.com/document/product/647/17275)。<br>
703
- * @param {Number} roomId - 【字段含义】房间号码(必填),指定房间号,在同一个房间里的用户(userId)可以彼此看到对方并进行视频通话。<br>
705
+ * @param {Number} roomId - 【字段含义】房间号码(必填),指定房间号,在同一个房间里的用户(userId)可以彼此看到对方并进行视频通话, roomId 和 strRoomId 必须填一个, 若您选用 strRoomId,则 roomId 需要填写为0。<br>
704
706
  * 【推荐取值】您可以随意指定,但请不要重复,如果您的用户账号 ID 是数字类型的,可以直接用创建者的用户 ID 作为 roomId。<br>
707
+ * @param {String} strRoomId - 【字段含义】字符串房间号码(选填),roomId 和 strRoomId 必须填一个。若两者都填,则优先选择 roomId。<br>
708
+ * 【推荐取值】您可以随意指定,但请不要重复。<br>
705
709
  * @param {TRTCRoleType} role - 【字段含义】直播场景下的角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom),视频通话场景下指定无效。<br>
706
710
  * 【推荐取值】默认值:主播(TRTCRoleAnchor)<br>
707
711
  * @param {String} privateMapKey - 【字段含义】房间签名(非必填),如果您希望某个房间只能让特定的某些 userId 进入,就需要使用 privateMapKey 进行权限保护。<br>
@@ -717,17 +721,17 @@ var TRTCWaterMarkSrcType;
717
721
  * 【参考文档】[云端录制](https://cloud.tencent.com/document/product/647/16823)。
718
722
  */
719
723
  class TRTCParams {
720
- constructor() {
721
- this.sdkAppId = 0;
722
- this.userId = null;
723
- this.userSig = null;
724
- this.roomId = 0;
725
- this.strRoomId = '';
726
- this.role = TRTCRoleType.TRTCRoleAnchor;
727
- this.privateMapKey = null;
728
- this.businessInfo = null;
729
- this.streamId = null;
730
- this.userDefineRecordId = null;
724
+ constructor(sdkAppId = 0, userId = '', userSig = '', roomId = 0, strRoomId = '', role = TRTCRoleType.TRTCRoleAnchor, privateMapKey = null, businessInfo = null, streamId = null, userDefineRecordId = null) {
725
+ this.sdkAppId = sdkAppId;
726
+ this.userId = userId;
727
+ this.userSig = userSig;
728
+ this.roomId = roomId;
729
+ this.strRoomId = strRoomId;
730
+ this.role = role;
731
+ this.privateMapKey = privateMapKey;
732
+ this.businessInfo = businessInfo;
733
+ this.streamId = streamId;
734
+ this.userDefineRecordId = userDefineRecordId;
731
735
  }
732
736
  }
733
737
  exports.TRTCParams = TRTCParams;
@@ -770,13 +774,13 @@ exports.TRTCParams = TRTCParams;
770
774
  * 【特别说明】若有录制需求,选择 YES 时,请确保通话过程中,调整分辨率不会影响您的录制效果。<br>
771
775
  */
772
776
  class TRTCVideoEncParam {
773
- constructor() {
774
- this.videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_360;
775
- this.resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape;
776
- this.videoFps = 15;
777
- this.videoBitrate = 550;
778
- this.minVideoBitrate = 0;
779
- this.enableAdjustRes = false;
777
+ constructor(videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_360, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape, videoFps = 15, videoBitrate = 550, minVideoBitrate = 0, enableAdjustRes = false) {
778
+ this.videoResolution = videoResolution;
779
+ this.resMode = resMode;
780
+ this.videoFps = videoFps;
781
+ this.videoBitrate = videoBitrate;
782
+ this.minVideoBitrate = minVideoBitrate;
783
+ this.enableAdjustRes = enableAdjustRes;
780
784
  }
781
785
  }
782
786
  exports.TRTCVideoEncParam = TRTCVideoEncParam;
@@ -792,10 +796,10 @@ exports.TRTCVideoEncParam = TRTCVideoEncParam;
792
796
  *
793
797
  */
794
798
  class TRTCRenderParams {
795
- constructor() {
796
- this.rotation = TRTCVideoRotation.TRTCVideoRotation0;
797
- this.fillMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit;
798
- this.mirrorType = TRTCVideoMirrorType.TRTCVideoMirrorType_Disable;
799
+ constructor(rotation = TRTCVideoRotation.TRTCVideoRotation0, fillMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit, mirrorType = TRTCVideoMirrorType.TRTCVideoMirrorType_Disable) {
800
+ this.rotation = rotation;
801
+ this.fillMode = fillMode;
802
+ this.mirrorType = mirrorType;
799
803
  }
800
804
  }
801
805
  exports.TRTCRenderParams = TRTCRenderParams;
@@ -816,9 +820,9 @@ exports.TRTCRenderParams = TRTCRenderParams;
816
820
  *
817
821
  */
818
822
  class TRTCNetworkQosParam {
819
- constructor() {
820
- this.preference = TRTCVideoQosPreference.TRTCVideoQosPreferenceClear;
821
- this.controlMode = TRTCQosControlMode.TRTCQosControlModeServer;
823
+ constructor(preference = TRTCVideoQosPreference.TRTCVideoQosPreferenceClear, controlMode = TRTCQosControlMode.TRTCQosControlModeServer) {
824
+ this.preference = preference;
825
+ this.controlMode = controlMode;
822
826
  }
823
827
  }
824
828
  exports.TRTCNetworkQosParam = TRTCNetworkQosParam;
@@ -833,9 +837,9 @@ exports.TRTCNetworkQosParam = TRTCNetworkQosParam;
833
837
  *
834
838
  */
835
839
  class TRTCQualityInfo {
836
- constructor() {
837
- this.userId = null;
838
- this.quality = TRTCQuality.TRTCQuality_Unknown;
840
+ constructor(userId = '', quality = TRTCQuality.TRTCQuality_Unknown) {
841
+ this.userId = userId;
842
+ this.quality = quality;
839
843
  }
840
844
  }
841
845
  exports.TRTCQualityInfo = TRTCQualityInfo;
@@ -850,9 +854,9 @@ exports.TRTCQualityInfo = TRTCQualityInfo;
850
854
  *
851
855
  */
852
856
  class TRTCVolumeInfo {
853
- constructor() {
854
- this.userId = null;
855
- this.volume = 0;
857
+ constructor(userId = '', volume = 0) {
858
+ this.userId = userId;
859
+ this.volume = volume;
856
860
  }
857
861
  }
858
862
  exports.TRTCVolumeInfo = TRTCVolumeInfo;
@@ -877,12 +881,12 @@ exports.TRTCVolumeInfo = TRTCVolumeInfo;
877
881
  *
878
882
  */
879
883
  class TRTCSpeedTestResult {
880
- constructor() {
881
- this.ip = null;
882
- this.quality = TRTCQuality.TRTCQuality_Unknown;
883
- this.upLostRate = 0.0;
884
- this.downLostRate = 0.0;
885
- this.rtt = 0;
884
+ constructor(ip = '', quality = TRTCQuality.TRTCQuality_Unknown, upLostRate = 0.0, downLostRate = 0.0, rtt = 0) {
885
+ this.ip = ip;
886
+ this.quality = quality;
887
+ this.upLostRate = upLostRate;
888
+ this.downLostRate = downLostRate;
889
+ this.rtt = rtt;
886
890
  }
887
891
  }
888
892
  exports.TRTCSpeedTestResult = TRTCSpeedTestResult;
@@ -924,13 +928,13 @@ exports.Rect = Rect;
924
928
  *
925
929
  */
926
930
  class TRTCMixUser {
927
- constructor() {
928
- this.userId = '';
929
- this.roomId = '';
930
- this.rect = null;
931
- this.zOrder = 0;
932
- this.pureAudio = false;
933
- this.streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig;
931
+ constructor(userId = '', roomId = '', rect = null, zOrder = 0, pureAudio = false, streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig) {
932
+ this.userId = userId;
933
+ this.roomId = roomId;
934
+ this.rect = rect;
935
+ this.zOrder = zOrder;
936
+ this.pureAudio = pureAudio;
937
+ this.streamType = streamType;
934
938
  }
935
939
  }
936
940
  exports.TRTCMixUser = TRTCMixUser;
@@ -1034,22 +1038,22 @@ var TRTCTranscodingConfigMode;
1034
1038
  * 【推荐取值】默认值:'',即房间里的多路流会混合到该接口调用者的视频流上。
1035
1039
  */
1036
1040
  class TRTCTranscodingConfig {
1037
- constructor() {
1038
- this.mode = TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown;
1039
- this.appId = 0;
1040
- this.bizId = 0;
1041
- this.videoWidth = 0;
1042
- this.videoHeight = 0;
1043
- this.videoBitrate = 0;
1044
- this.videoFramerate = 15;
1045
- this.videoGOP = 2;
1046
- this.audioSampleRate = 64;
1047
- this.audioBitrate = 48000;
1048
- this.audioChannels = 1;
1049
- this.mixUsersArray = [];
1050
- this.backgroundColor = 0;
1051
- this.backgroundImage = '';
1052
- this.streamId = '';
1041
+ constructor(mode = TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown, appId = 0, bizId = 0, videoWidth = 0, videoHeight = 0, videoBitrate = 0, videoFramerate = 15, videoGOP = 2, backgroundColor = 0, backgroundImage = '', audioSampleRate = 64, audioBitrate = 48000, audioChannels = 1, mixUsersArray = [], streamId = '') {
1042
+ this.mode = mode;
1043
+ this.appId = appId;
1044
+ this.bizId = bizId;
1045
+ this.videoWidth = videoWidth;
1046
+ this.videoHeight = videoHeight;
1047
+ this.videoBitrate = videoBitrate;
1048
+ this.videoFramerate = videoFramerate;
1049
+ this.videoGOP = videoGOP;
1050
+ this.backgroundColor = backgroundColor;
1051
+ this.backgroundImage = backgroundImage;
1052
+ this.audioSampleRate = audioSampleRate;
1053
+ this.audioBitrate = audioBitrate;
1054
+ this.audioChannels = audioChannels;
1055
+ this.mixUsersArray = mixUsersArray;
1056
+ this.streamId = streamId;
1053
1057
  }
1054
1058
  }
1055
1059
  exports.TRTCTranscodingConfig = TRTCTranscodingConfig;
@@ -1063,10 +1067,10 @@ exports.TRTCTranscodingConfig = TRTCTranscodingConfig;
1063
1067
  *
1064
1068
  */
1065
1069
  class TRTCPublishCDNParam {
1066
- constructor() {
1067
- this.appId = 0;
1068
- this.bizId = 0;
1069
- this.url = null;
1070
+ constructor(appId = 0, bizId = 0, url = null) {
1071
+ this.appId = appId;
1072
+ this.bizId = bizId;
1073
+ this.url = url;
1070
1074
  }
1071
1075
  }
1072
1076
  exports.TRTCPublishCDNParam = TRTCPublishCDNParam;
@@ -1081,8 +1085,8 @@ exports.TRTCPublishCDNParam = TRTCPublishCDNParam;
1081
1085
  *
1082
1086
  */
1083
1087
  class TRTCAudioRecordingParams {
1084
- constructor() {
1085
- this.filePath = null;
1088
+ constructor(filePath = null) {
1089
+ this.filePath = filePath;
1086
1090
  }
1087
1091
  }
1088
1092
  exports.TRTCAudioRecordingParams = TRTCAudioRecordingParams;
@@ -1101,12 +1105,12 @@ exports.TRTCAudioRecordingParams = TRTCAudioRecordingParams;
1101
1105
  * 【推荐取值】取值范围为0 - 100;默认值:100
1102
1106
  */
1103
1107
  class TRTCAudioEffectParam {
1104
- constructor() {
1105
- this.effectId = 0;
1106
- this.path = '';
1107
- this.loopCount = 0;
1108
- this.publish = false;
1109
- this.volume = 100;
1108
+ constructor(effectId = 0, path = '', loopCount = 0, publish = false, volume = 100) {
1109
+ this.effectId = effectId;
1110
+ this.path = path;
1111
+ this.loopCount = loopCount;
1112
+ this.publish = publish;
1113
+ this.volume = volume;
1110
1114
  }
1111
1115
  }
1112
1116
  exports.TRTCAudioEffectParam = TRTCAudioEffectParam;
@@ -1124,14 +1128,14 @@ exports.TRTCAudioEffectParam = TRTCAudioEffectParam;
1124
1128
  *
1125
1129
  */
1126
1130
  class TRTCLocalStatistics {
1127
- constructor() {
1128
- this.width = 0;
1129
- this.height = 0;
1130
- this.frameRate = 0;
1131
- this.videoBitrate = 0;
1132
- this.audioSampleRate = 0;
1133
- this.audioBitrate = 0;
1134
- this.streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig;
1131
+ constructor(width = 0, height = 0, frameRate = 0, videoBitrate = 0, audioSampleRate = 0, audioBitrate = 0, streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig) {
1132
+ this.width = width;
1133
+ this.height = height;
1134
+ this.frameRate = frameRate;
1135
+ this.videoBitrate = videoBitrate;
1136
+ this.audioSampleRate = audioSampleRate;
1137
+ this.audioBitrate = audioBitrate;
1138
+ this.streamType = streamType;
1135
1139
  }
1136
1140
  }
1137
1141
  exports.TRTCLocalStatistics = TRTCLocalStatistics;
@@ -1159,21 +1163,21 @@ exports.TRTCLocalStatistics = TRTCLocalStatistics;
1159
1163
  *
1160
1164
  */
1161
1165
  class TRTCRemoteStatistics {
1162
- constructor() {
1163
- this.userId = '';
1164
- this.finalLoss = 0;
1165
- this.width = 0;
1166
- this.height = 0;
1167
- this.frameRate = 0;
1168
- this.videoBitrate = 0;
1169
- this.audioSampleRate = 0;
1170
- this.audioBitrate = 0;
1171
- this.jitterBufferDelay = 0;
1172
- this.audioTotalBlockTime = 0;
1173
- this.audioBlockRate = 0;
1174
- this.videoTotalBlockTime = 0;
1175
- this.videoBlockRate = 0;
1176
- this.streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig;
1166
+ constructor(userId = '', finalLoss = 0, width = 0, height = 0, frameRate = 0, videoBitrate = 0, audioSampleRate = 0, audioBitrate = 0, jitterBufferDelay = 0, audioTotalBlockTime = 0, audioBlockRate = 0, videoTotalBlockTime = 0, videoBlockRate = 0, streamType = TRTCVideoStreamType.TRTCVideoStreamTypeBig) {
1167
+ this.userId = userId;
1168
+ this.finalLoss = finalLoss;
1169
+ this.width = width;
1170
+ this.height = height;
1171
+ this.frameRate = frameRate;
1172
+ this.videoBitrate = videoBitrate;
1173
+ this.audioSampleRate = audioSampleRate;
1174
+ this.audioBitrate = audioBitrate;
1175
+ this.jitterBufferDelay = jitterBufferDelay;
1176
+ this.audioTotalBlockTime = audioTotalBlockTime;
1177
+ this.audioBlockRate = audioBlockRate;
1178
+ this.videoTotalBlockTime = videoTotalBlockTime;
1179
+ this.videoBlockRate = videoBlockRate;
1180
+ this.streamType = streamType;
1177
1181
  }
1178
1182
  }
1179
1183
  exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
@@ -1190,9 +1194,6 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1190
1194
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
1191
1195
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
1192
1196
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
1193
- * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
1194
- * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
1195
- * 当网络为蜂窝网非 WiFi 类型时,该值无效。
1196
1197
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
1197
1198
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
1198
1199
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -1202,19 +1203,18 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1202
1203
  *
1203
1204
  */
1204
1205
  class TRTCStatistics {
1205
- constructor() {
1206
- this.upLoss = 0;
1207
- this.downLoss = 0;
1208
- this.appCpu = 0;
1209
- this.systemCpu = 0;
1210
- this.rtt = 0;
1211
- this.gatewayRtt = 0;
1212
- this.receivedBytes = 0;
1213
- this.sentBytes = 0;
1214
- this.localStatisticsArray = null;
1215
- this.localStatisticsArraySize = 0;
1216
- this.remoteStatisticsArray = [];
1217
- this.remoteStatisticsArraySize = 0;
1206
+ constructor(upLoss = 0, downLoss = 0, appCpu = 0, systemCpu = 0, rtt = 0, receivedBytes = 0, sentBytes = 0, localStatisticsArray = [], localStatisticsArraySize = 0, remoteStatisticsArray = [], remoteStatisticsArraySize = 0) {
1207
+ this.upLoss = upLoss;
1208
+ this.downLoss = downLoss;
1209
+ this.appCpu = appCpu;
1210
+ this.systemCpu = systemCpu;
1211
+ this.rtt = rtt;
1212
+ this.receivedBytes = receivedBytes;
1213
+ this.sentBytes = sentBytes;
1214
+ this.localStatisticsArray = localStatisticsArray;
1215
+ this.localStatisticsArraySize = localStatisticsArraySize;
1216
+ this.remoteStatisticsArray = remoteStatisticsArray;
1217
+ this.remoteStatisticsArraySize = remoteStatisticsArraySize;
1218
1218
  }
1219
1219
  }
1220
1220
  exports.TRTCStatistics = TRTCStatistics;
@@ -1232,14 +1232,14 @@ exports.TRTCStatistics = TRTCStatistics;
1232
1232
  *
1233
1233
  */
1234
1234
  class AudioMusicParam {
1235
- constructor() {
1236
- this.id = 0;
1237
- this.path = '';
1238
- this.loopCount = 0;
1239
- this.publish = true;
1240
- this.isShortFile = false;
1241
- this.startTimeMS = 0;
1242
- this.endTimeMS = 0;
1235
+ constructor(id = 0, path = '', loopCount = 0, publish = true, isShortFile = false, startTimeMS = 0, endTimeMS = 0) {
1236
+ this.id = id;
1237
+ this.path = path;
1238
+ this.loopCount = loopCount;
1239
+ this.publish = publish;
1240
+ this.isShortFile = isShortFile;
1241
+ this.startTimeMS = startTimeMS;
1242
+ this.endTimeMS = endTimeMS;
1243
1243
  }
1244
1244
  }
1245
1245
  exports.AudioMusicParam = AudioMusicParam;
@@ -1254,11 +1254,11 @@ exports.AudioMusicParam = AudioMusicParam;
1254
1254
  *
1255
1255
  */
1256
1256
  class TRTCSwitchRoomParam {
1257
- constructor() {
1258
- this.roomId = 0;
1259
- this.strRoomId = '';
1260
- this.userSig = '';
1261
- this.privateMapKey = '';
1257
+ constructor(roomId = 0, strRoomId = '', userSig = '', privateMapKey = '') {
1258
+ this.roomId = roomId;
1259
+ this.strRoomId = strRoomId;
1260
+ this.userSig = userSig;
1261
+ this.privateMapKey = privateMapKey;
1262
1262
  }
1263
1263
  }
1264
1264
  exports.TRTCSwitchRoomParam = TRTCSwitchRoomParam;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.5.100-beta.0",
3
+ "version": "9.5.112-beta.2",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",
@@ -34,7 +34,7 @@ const cos = new COS({
34
34
 
35
35
  const bucket = 'sdk-web-1252463788';
36
36
  const region = 'ap-hongkong';
37
- const keyPrefix = 'trtc/electron/doc/zh-cn/trtc_electron_sdk';
37
+ const keyPrefix = 'trtc/electron/doc/zh-cn/trtc_electron_sdk/';
38
38
  const docPath = path.join(__dirname, '../_doc');
39
39
 
40
40
  function walkSync(dir, filelist) {