trtc-electron-sdk 9.3.8-beta.0 → 9.3.109-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/liteav/trtc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo } from './trtc_define';
3
+ import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo, TRTCSpeedTestParams } from './trtc_define';
4
4
  export * from './trtc_define';
5
5
  export * from './trtc_code';
6
6
  /**
@@ -39,6 +39,7 @@ declare class TRTCCloud extends EventEmitter {
39
39
  private audioQuality;
40
40
  private bgmId;
41
41
  private playAudioEffectIdList;
42
+ private isStartLocalPreview;
42
43
  constructor();
43
44
  /**
44
45
  * 创建 TRTCCloud 对象单例
@@ -323,14 +324,23 @@ declare class TRTCCloud extends EventEmitter {
323
324
  */
324
325
  handleOnConnectionRecovery(): void;
325
326
  /**
326
- * 5.4 服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
327
+ * 5.4 废弃事件:服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
327
328
  *
329
+ * @deprecated
328
330
  * @event TRTCCallback#onSpeedTest
329
331
  * @param {TRTCSpeedTestResult} currentResult - 当前完成的测速结果
330
332
  * @param {Number} finishedCount - 已完成测速的服务器数量
331
333
  * @param {Number} totalCount - 需要测速的服务器总数量
332
334
  */
333
335
  bindOnSpeedTest(): void;
336
+ /**
337
+ * 5.5 网速测试的结果回调
338
+ *
339
+ * @event TRTCCallback#onSpeedTestResult
340
+ * 该统计回调由 @link TRTCCloud#startSpeedTest 触发。
341
+ * @param {TRTCSpeedTestResult} result - 网速测试数据数据,包括丢包、往返延迟、上下行的带宽速率,详情请参考 {@link TRTCSpeedTestResult}。
342
+ */
343
+ bindOnSpeedTestResult(): void;
334
344
  /**
335
345
  * 6.1 摄像头准备就绪
336
346
  *
@@ -793,6 +803,8 @@ declare class TRTCCloud extends EventEmitter {
793
803
  *
794
804
  * 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
795
805
  *
806
+ * 注意:混流转码为收费功能,调用接口将产生云端混流转码费用,详见 [云端混流转码计费说明](https://cloud.tencent.com/document/product/647/49446)。
807
+ *
796
808
  * @note 关于云端混流的注意事项:
797
809
  * - 云端转码会引入一定的 CDN 观看延时,大概会增加1 - 2秒。
798
810
  * - 调用该函数的用户,会将连麦中的多路画面混合到自己当前这路画面中。
@@ -1441,10 +1453,12 @@ declare class TRTCCloud extends EventEmitter {
1441
1453
  * @param {Number} captureRect.bottom - 指定捕获的区域的下坐标
1442
1454
  * @param {Boolean} captureMouse - 指定是否捕获鼠标指针
1443
1455
  * @param {Boolean} highlightWindow - 指定是否高亮正在共享的窗口,以及当捕获图像被遮挡时高亮遮挡窗口提示用户移走遮挡
1456
+ * @param {Boolean} enableHighPerformance - 是否开启高性能模式(只会在分享屏幕时会生效),默认为 true。
1457
+ * 【特殊说明】开启后屏幕采集性能最佳,但会丧失抗遮挡能力,如果您同时开启 enableHighLight + enableHighPerformance,远端用户可以看到高亮的边框。
1444
1458
  */
1445
- selectScreenCaptureTarget(type: number, sourceId: string, sourcename: string, captureRect: Rect, captureMouse: boolean, highlightWindow: boolean): any;
1459
+ selectScreenCaptureTarget(type: number, sourceId: string, sourcename: string, captureRect: Rect, captureMouse: boolean, highlightWindow: boolean, enableHighPerformance?: boolean): any;
1446
1460
  /**
1447
- * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。(暂不支持 mac 平台预览界面)
1461
+ * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
1448
1462
  *
1449
1463
  * 注意:
1450
1464
  * 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
@@ -1839,13 +1853,16 @@ declare class TRTCCloud extends EventEmitter {
1839
1853
  * 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
1840
1854
  * 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
1841
1855
  *
1842
- * 注意:测速本身会消耗一定的流量,所以也会产生少量额外的流量费用。
1856
+ * 注意:测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
1843
1857
  *
1844
- * @param {Number} sdkAppId - 应用标识
1845
- * @param {String} userId - 用户标识
1846
- * @param {String} userSig - 用户签名
1858
+ * @param {TRTCSpeedTestParams} params - 网络测速参数
1859
+ * @param {Number} params.sdkAppId - 应用标识(必填)
1860
+ * @param {String} params.userId - 用户标识(必填)
1861
+ * @param {String} params.userSig - 用户签名(必填)
1862
+ * @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)
1863
+ * @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
1847
1864
  */
1848
- startSpeedTest(sdkAppId: number, userId: string, userSig: string): void;
1865
+ startSpeedTest(params: TRTCSpeedTestParams | number, userId?: string, userSig?: string): void;
1849
1866
  /**
1850
1867
  * 13.2 停止网络测速
1851
1868
  */
@@ -1975,7 +1992,6 @@ declare class TRTCCloud extends EventEmitter {
1975
1992
  removePlugin(id: string): void;
1976
1993
  getPluginList(): PluginInfo[];
1977
1994
  createPlugin(pluginId: string): PluginInfo;
1978
- setPluginCallback(pluginCb: (pluginId: string, errorCode: number, msg: string) => void): void;
1979
1995
  getKey(uid: string, type: TRTCVideoStreamType): string;
1980
1996
  /**
1981
1997
  * 判断是否支持webGL
@@ -2004,5 +2020,6 @@ declare class TRTCCloud extends EventEmitter {
2004
2020
  _YUV2RGBA(width: number, height: number, buffer: ArrayBufferLike): Uint8ClampedArray;
2005
2021
  _BGRA2RGBA(data: ArrayBuffer, width: number, height: number): Uint8ClampedArray;
2006
2022
  _isMacPlatform(): boolean;
2023
+ _isLocalUser(uid: string): boolean;
2007
2024
  }
2008
2025
  export default TRTCCloud;
package/liteav/trtc.js CHANGED
@@ -116,6 +116,7 @@ class TRTCCloud extends events_1.EventEmitter {
116
116
  // 生成一个足够大, 不会与用户输入重复的 id
117
117
  this.bgmId = 1 << 29;
118
118
  this.playAudioEffectIdList = [];
119
+ this.isStartLocalPreview = false;
119
120
  this.initEventHandler();
120
121
  console.log('constructor render:' + this.renderMode + '|sdk version:' + pkg.version +
121
122
  '|native sdk version:' + this.rtcCloud.getSDKVersion());
@@ -160,6 +161,7 @@ class TRTCCloud extends events_1.EventEmitter {
160
161
  */
161
162
  destroy() {
162
163
  this.firstVideoFrameList = [];
164
+ this.isStartLocalPreview = false;
163
165
  this.playAudioEffectIdList = [];
164
166
  this.rtcCloud.destroy();
165
167
  }
@@ -338,6 +340,7 @@ class TRTCCloud extends events_1.EventEmitter {
338
340
  this.bindOnNetworkQuality();
339
341
  this.bindOnStatistics();
340
342
  this.bindOnSpeedTest();
343
+ this.bindOnSpeedTestResult();
341
344
  this.bindOnUserVoiceVolume();
342
345
  this.bindOnRecvCustomCmdMsg();
343
346
  this.bindOnMissCustomCmdMsg();
@@ -418,6 +421,7 @@ class TRTCCloud extends events_1.EventEmitter {
418
421
  */
419
422
  handleOnExitRoom(reason) {
420
423
  this.firstVideoFrameList = [];
424
+ this.isStartLocalPreview = false;
421
425
  this.fire('onExitRoom', reason);
422
426
  }
423
427
  /**
@@ -703,8 +707,9 @@ class TRTCCloud extends events_1.EventEmitter {
703
707
  this.fire('onConnectionRecovery');
704
708
  }
705
709
  /**
706
- * 5.4 服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
710
+ * 5.4 废弃事件:服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
707
711
  *
712
+ * @deprecated
708
713
  * @event TRTCCallback#onSpeedTest
709
714
  * @param {TRTCSpeedTestResult} currentResult - 当前完成的测速结果
710
715
  * @param {Number} finishedCount - 已完成测速的服务器数量
@@ -715,6 +720,18 @@ class TRTCCloud extends events_1.EventEmitter {
715
720
  this.fire('onSpeedTest', currentResult, finishedCount, totalCount);
716
721
  });
717
722
  }
723
+ /**
724
+ * 5.5 网速测试的结果回调
725
+ *
726
+ * @event TRTCCallback#onSpeedTestResult
727
+ * 该统计回调由 @link TRTCCloud#startSpeedTest 触发。
728
+ * @param {TRTCSpeedTestResult} result - 网速测试数据数据,包括丢包、往返延迟、上下行的带宽速率,详情请参考 {@link TRTCSpeedTestResult}。
729
+ */
730
+ bindOnSpeedTestResult() {
731
+ this.rtcCloud.onEvent('onSpeedTestResult', (result) => {
732
+ this.fire('onSpeedTestResult', result);
733
+ });
734
+ }
718
735
  /////////////////////////////////////////////////////////////////////////////////
719
736
  //
720
737
  // (六)硬件设备事件回调
@@ -1335,6 +1352,8 @@ class TRTCCloud extends events_1.EventEmitter {
1335
1352
  *
1336
1353
  * 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
1337
1354
  *
1355
+ * 注意:混流转码为收费功能,调用接口将产生云端混流转码费用,详见 [云端混流转码计费说明](https://cloud.tencent.com/document/product/647/49446)。
1356
+ *
1338
1357
  * @note 关于云端混流的注意事项:
1339
1358
  * - 云端转码会引入一定的 CDN 观看延时,大概会增加1 - 2秒。
1340
1359
  * - 调用该函数的用户,会将连麦中的多路画面混合到自己当前这路画面中。
@@ -1423,6 +1442,7 @@ class TRTCCloud extends events_1.EventEmitter {
1423
1442
  let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1424
1443
  this._initRender(key, view);
1425
1444
  }
1445
+ this.isStartLocalPreview = true;
1426
1446
  this.rtcCloud.startLocalPreview();
1427
1447
  this.addLocalVideoRenderCallback();
1428
1448
  }
@@ -1434,12 +1454,13 @@ class TRTCCloud extends events_1.EventEmitter {
1434
1454
  * 3.2 停止本地摄像头采集和预览
1435
1455
  */
1436
1456
  stopLocalPreview() {
1457
+ this.isStartLocalPreview = false;
1458
+ this.firstVideoFrameList = this.firstVideoFrameList.filter((item) => {
1459
+ return !(this._isLocalUser(item.uid) && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1460
+ });
1437
1461
  let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1438
1462
  this._destroyRender(key, null);
1439
1463
  this.rtcCloud.stopLocalPreview();
1440
- this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
1441
- return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1442
- });
1443
1464
  }
1444
1465
  /**
1445
1466
  * 3.3 是否屏蔽自己的视频画面
@@ -2298,17 +2319,19 @@ class TRTCCloud extends events_1.EventEmitter {
2298
2319
  * @param {Number} captureRect.bottom - 指定捕获的区域的下坐标
2299
2320
  * @param {Boolean} captureMouse - 指定是否捕获鼠标指针
2300
2321
  * @param {Boolean} highlightWindow - 指定是否高亮正在共享的窗口,以及当捕获图像被遮挡时高亮遮挡窗口提示用户移走遮挡
2322
+ * @param {Boolean} enableHighPerformance - 是否开启高性能模式(只会在分享屏幕时会生效),默认为 true。
2323
+ * 【特殊说明】开启后屏幕采集性能最佳,但会丧失抗遮挡能力,如果您同时开启 enableHighLight + enableHighPerformance,远端用户可以看到高亮的边框。
2301
2324
  */
2302
- selectScreenCaptureTarget(type, sourceId, sourcename, captureRect, captureMouse, highlightWindow) {
2325
+ selectScreenCaptureTarget(type, sourceId, sourcename, captureRect, captureMouse, highlightWindow, enableHighPerformance = true) {
2303
2326
  if (sourceId !== null && sourceId !== undefined && sourcename !== null && sourcename !== undefined) {
2304
- return this.rtcCloud.selectScreenCaptureTarget(type, sourceId, sourcename, captureRect.left, captureRect.top, captureRect.right, captureRect.bottom, captureMouse, highlightWindow);
2327
+ return this.rtcCloud.selectScreenCaptureTarget(type, sourceId, sourcename, captureRect.left, captureRect.top, captureRect.right, captureRect.bottom, captureMouse, highlightWindow, enableHighPerformance);
2305
2328
  }
2306
2329
  else {
2307
2330
  console.error('selectScreenCaptureTarget, sourceId or sourcename is undefined!');
2308
2331
  }
2309
2332
  }
2310
2333
  /**
2311
- * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。(暂不支持 mac 平台预览界面)
2334
+ * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
2312
2335
  *
2313
2336
  * 注意:
2314
2337
  * 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
@@ -2909,14 +2932,27 @@ class TRTCCloud extends events_1.EventEmitter {
2909
2932
  * 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
2910
2933
  * 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
2911
2934
  *
2912
- * 注意:测速本身会消耗一定的流量,所以也会产生少量额外的流量费用。
2935
+ * 注意:测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
2913
2936
  *
2914
- * @param {Number} sdkAppId - 应用标识
2915
- * @param {String} userId - 用户标识
2916
- * @param {String} userSig - 用户签名
2937
+ * @param {TRTCSpeedTestParams} params - 网络测速参数
2938
+ * @param {Number} params.sdkAppId - 应用标识(必填)
2939
+ * @param {String} params.userId - 用户标识(必填)
2940
+ * @param {String} params.userSig - 用户签名(必填)
2941
+ * @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)
2942
+ * @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
2917
2943
  */
2918
- startSpeedTest(sdkAppId, userId, userSig) {
2919
- this.rtcCloud.startSpeedTest(sdkAppId, userId, userSig);
2944
+ startSpeedTest(params, userId, userSig) {
2945
+ if (params instanceof trtc_define_1.TRTCSpeedTestParams) {
2946
+ this.rtcCloud.startSpeedTest(params.sdkAppId, params.userId, params.userSig, params.expectedUpBandwidth, params.expectedDownBandwidth);
2947
+ }
2948
+ else if (typeof params === 'number' && typeof userId === 'string' && typeof userSig === 'string') {
2949
+ // 兼容旧版本调用
2950
+ let sdkAppId = params;
2951
+ this.rtcCloud.startSpeedTest(sdkAppId, userId, userSig, 0, 0);
2952
+ }
2953
+ else {
2954
+ console.error('enterRoom, params error!');
2955
+ }
2920
2956
  }
2921
2957
  /**
2922
2958
  * 13.2 停止网络测速
@@ -2955,8 +2991,8 @@ class TRTCCloud extends events_1.EventEmitter {
2955
2991
  let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2956
2992
  this._destroyRender(key, null);
2957
2993
  this.rtcCloud.stopCameraDeviceTest();
2958
- this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
2959
- return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2994
+ this.firstVideoFrameList = this.firstVideoFrameList.filter((item) => {
2995
+ return !(this._isLocalUser(item.uid) && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2960
2996
  });
2961
2997
  }
2962
2998
  /**
@@ -3168,15 +3204,9 @@ class TRTCCloud extends events_1.EventEmitter {
3168
3204
  },
3169
3205
  setParameter: (param) => {
3170
3206
  return this.rtcCloud.setPluginParameter(pluginId, param);
3171
- },
3172
- getParameter: () => {
3173
- return this.rtcCloud.getPluginParameter(pluginId);
3174
3207
  }
3175
3208
  };
3176
3209
  }
3177
- setPluginCallback(pluginCb) {
3178
- this.rtcCloud.setPluginCallback(pluginCb);
3179
- }
3180
3210
  getKey(uid, type) {
3181
3211
  return String(uid) + '_' + String(type);
3182
3212
  }
@@ -3215,6 +3245,7 @@ class TRTCCloud extends events_1.EventEmitter {
3215
3245
  return this.streams.get(key);
3216
3246
  }
3217
3247
  _onRenderFrame(uid, type, width, height, timestamp, rotation, data) {
3248
+ const isCurrentLocalUser = this._isLocalUser(uid);
3218
3249
  // 由于 mac 监听自定义渲染回调后不会回调 onFirstVideoFrame ,所以在这里自己实现回调 onFirstVideoFrame
3219
3250
  if (this._isMacPlatform()) {
3220
3251
  setImmediate(() => {
@@ -3222,12 +3253,14 @@ class TRTCCloud extends events_1.EventEmitter {
3222
3253
  return uid === item.uid && type === item.type;
3223
3254
  });
3224
3255
  if (index === -1) {
3225
- this.emit('onFirstVideoFrame', uid, type, width, height);
3226
- this.firstVideoFrameList.push({ uid: uid, type: type });
3256
+ if (!isCurrentLocalUser || this.isStartLocalPreview) {
3257
+ this.emit('onFirstVideoFrame', uid, type, width, height);
3258
+ this.firstVideoFrameList.push({ uid: uid, type: type });
3259
+ }
3227
3260
  }
3228
3261
  });
3229
3262
  }
3230
- if (uid.length == 0) {
3263
+ if (isCurrentLocalUser) {
3231
3264
  if (this.isExternalRenderEnabled) {
3232
3265
  this.fire(CUSTOM_VIDEO_DATA, {
3233
3266
  uid: '', type, rotation, timestamp,
@@ -3468,6 +3501,9 @@ class TRTCCloud extends events_1.EventEmitter {
3468
3501
  _isMacPlatform() {
3469
3502
  return process.platform == 'darwin';
3470
3503
  }
3504
+ _isLocalUser(uid) {
3505
+ return uid === '';
3506
+ }
3471
3507
  }
3472
3508
  class VideoRenderCallback {
3473
3509
  constructor() {
@@ -374,6 +374,8 @@ export declare class TRTCVolumeInfo {
374
374
  * @param {Number} upLostRate - 上行丢包率,范围是[0 - 1.0],例如0.3代表每向服务器发送10个数据包,可能有3个会在中途丢失。
375
375
  * @param {Number} downLostRate - 下行丢包率,范围是[0 - 1.0],例如0.2代表从服务器每收取10个数据包,可能有2个会在中途丢失。
376
376
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好,正常数值在10ms - 100ms之间。
377
+ * @param {Number} availableUpBandwidth - 上行带宽(kbps,-1:无效值)。
378
+ * @param {Number} availableDownBandwidth - 下行带宽(kbps,-1:无效值)。
377
379
  *
378
380
  */
379
381
  export declare class TRTCSpeedTestResult {
@@ -382,7 +384,29 @@ export declare class TRTCSpeedTestResult {
382
384
  upLostRate: number;
383
385
  downLostRate: number;
384
386
  rtt: number;
385
- constructor(ip?: string, quality?: TRTCQuality, upLostRate?: number, downLostRate?: number, rtt?: number);
387
+ availableUpBandwidth: number;
388
+ availableDownBandwidth: number;
389
+ constructor(ip?: string, quality?: TRTCQuality, upLostRate?: number, downLostRate?: number, rtt?: number, availableUpBandwidth?: number, availableDownBandwidth?: number);
390
+ }
391
+ /**
392
+ * 5.9 测速参数
393
+ *
394
+ * 您可以在用户进入房间前通过 {@link startSpeedTest} 接口测试网速(注意:请不要在通话中调用)。
395
+ *
396
+ * @param {String} sdkAppId - 应用标识
397
+ * @param {String} userId - 用户标识
398
+ * @param {String} userSig - 用户签名
399
+ * @param {Number} expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)
400
+ * @param {Number} expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
401
+ *
402
+ */
403
+ export declare class TRTCSpeedTestParams {
404
+ sdkAppId: number;
405
+ userId: string;
406
+ userSig: string;
407
+ expectedUpBandwidth: number;
408
+ expectedDownBandwidth: number;
409
+ constructor(sdkAppId?: number, userId?: string, userSig?: string, expectedUpBandwidth?: number, expectedDownBandwidth?: number);
386
410
  }
387
411
  /**
388
412
  * 记录矩形的四个点坐标
@@ -616,6 +640,9 @@ export declare class TRTCRemoteStatistics {
616
640
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
617
641
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
618
642
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
643
+ * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
644
+ * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
645
+ * 当网络为蜂窝网非 WiFi 类型时,该值无效。
619
646
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
620
647
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
621
648
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -630,13 +657,14 @@ export declare class TRTCStatistics {
630
657
  appCpu: number;
631
658
  systemCpu: number;
632
659
  rtt: number;
660
+ gatewayRtt: number;
633
661
  receivedBytes: number;
634
662
  sentBytes: number;
635
663
  localStatisticsArray: TRTCLocalStatistics[];
636
664
  localStatisticsArraySize: number;
637
665
  remoteStatisticsArray: TRTCRemoteStatistics[];
638
666
  remoteStatisticsArraySize: number;
639
- constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number);
667
+ constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, gatewayRtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number);
640
668
  }
641
669
  /**
642
670
  * 音乐参数
@@ -693,5 +721,4 @@ export interface PluginInfo {
693
721
  enable: () => number;
694
722
  disable: () => number;
695
723
  setParameter: (param: string) => number;
696
- getParameter: (paramKey: string) => string;
697
724
  }
@@ -6,7 +6,7 @@
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.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestResult = 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.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
9
+ exports.TRTCSwitchRoomParam = exports.AudioMusicParam = exports.TRTCStatistics = exports.TRTCRemoteStatistics = exports.TRTCLocalStatistics = exports.TRTCAudioEffectParam = exports.TRTCAudioRecordingParams = exports.TRTCPublishCDNParam = exports.TRTCTranscodingConfig = exports.TRTCTranscodingConfigMode = exports.TRTCMixUser = exports.Rect = exports.TRTCSpeedTestParams = exports.TRTCSpeedTestResult = 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.TRTCScreenCaptureSourceInfo = exports.TRTCImageBuffer = exports.TRTCAudioQuality = exports.TRTCScreenCaptureSourceType = exports.TRTCAudioFrameFormat = exports.TRTCVideoQosPreference = exports.TRTCQosControlMode = exports.TRTCRoleType = exports.TRTCAppScene = exports.TRTCVideoMirrorType = exports.TRTCVideoBufferType = exports.TRTCVideoPixelFormat = exports.TRTCBeautyStyle = exports.TRTCVideoRotation = exports.TRTCVideoFillMode = exports.TRTCQuality = exports.TRTCVideoStreamType = exports.TRTCVideoResolutionMode = exports.TRTCVideoResolution = void 0;
10
10
  /////////////////////////////////////////////////////////////////////////////////
11
11
  //
12
12
  // 【(一)视频相关枚举值定义】
@@ -878,19 +878,45 @@ exports.TRTCVolumeInfo = TRTCVolumeInfo;
878
878
  * @param {Number} upLostRate - 上行丢包率,范围是[0 - 1.0],例如0.3代表每向服务器发送10个数据包,可能有3个会在中途丢失。
879
879
  * @param {Number} downLostRate - 下行丢包率,范围是[0 - 1.0],例如0.2代表从服务器每收取10个数据包,可能有2个会在中途丢失。
880
880
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好,正常数值在10ms - 100ms之间。
881
+ * @param {Number} availableUpBandwidth - 上行带宽(kbps,-1:无效值)。
882
+ * @param {Number} availableDownBandwidth - 下行带宽(kbps,-1:无效值)。
881
883
  *
882
884
  */
883
885
  class TRTCSpeedTestResult {
884
- constructor(ip = '', quality = TRTCQuality.TRTCQuality_Unknown, upLostRate = 0.0, downLostRate = 0.0, rtt = 0) {
886
+ constructor(ip = '', quality = TRTCQuality.TRTCQuality_Unknown, upLostRate = 0.0, downLostRate = 0.0, rtt = 0, availableUpBandwidth = -1, availableDownBandwidth = -1) {
885
887
  this.ip = ip;
886
888
  this.quality = quality;
887
889
  this.upLostRate = upLostRate;
888
890
  this.downLostRate = downLostRate;
889
891
  this.rtt = rtt;
892
+ this.availableUpBandwidth = availableUpBandwidth;
893
+ this.availableDownBandwidth = availableDownBandwidth;
890
894
  }
891
895
  }
892
896
  exports.TRTCSpeedTestResult = TRTCSpeedTestResult;
893
897
  ;
898
+ /**
899
+ * 5.9 测速参数
900
+ *
901
+ * 您可以在用户进入房间前通过 {@link startSpeedTest} 接口测试网速(注意:请不要在通话中调用)。
902
+ *
903
+ * @param {String} sdkAppId - 应用标识
904
+ * @param {String} userId - 用户标识
905
+ * @param {String} userSig - 用户签名
906
+ * @param {Number} expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)
907
+ * @param {Number} expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
908
+ *
909
+ */
910
+ class TRTCSpeedTestParams {
911
+ constructor(sdkAppId = 0, userId = '', userSig = '', expectedUpBandwidth = 0, expectedDownBandwidth = 0) {
912
+ this.sdkAppId = sdkAppId;
913
+ this.userId = userId;
914
+ this.userSig = userSig;
915
+ this.expectedUpBandwidth = expectedUpBandwidth;
916
+ this.expectedDownBandwidth = expectedDownBandwidth;
917
+ }
918
+ }
919
+ exports.TRTCSpeedTestParams = TRTCSpeedTestParams;
894
920
  /**
895
921
  * 记录矩形的四个点坐标
896
922
  *
@@ -1194,6 +1220,9 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1194
1220
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
1195
1221
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
1196
1222
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
1223
+ * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
1224
+ * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
1225
+ * 当网络为蜂窝网非 WiFi 类型时,该值无效。
1197
1226
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
1198
1227
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
1199
1228
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -1203,12 +1232,13 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1203
1232
  *
1204
1233
  */
1205
1234
  class TRTCStatistics {
1206
- constructor(upLoss = 0, downLoss = 0, appCpu = 0, systemCpu = 0, rtt = 0, receivedBytes = 0, sentBytes = 0, localStatisticsArray = [], localStatisticsArraySize = 0, remoteStatisticsArray = [], remoteStatisticsArraySize = 0) {
1235
+ constructor(upLoss = 0, downLoss = 0, appCpu = 0, systemCpu = 0, rtt = 0, gatewayRtt = 0, receivedBytes = 0, sentBytes = 0, localStatisticsArray = [], localStatisticsArraySize = 0, remoteStatisticsArray = [], remoteStatisticsArraySize = 0) {
1207
1236
  this.upLoss = upLoss;
1208
1237
  this.downLoss = downLoss;
1209
1238
  this.appCpu = appCpu;
1210
1239
  this.systemCpu = systemCpu;
1211
1240
  this.rtt = rtt;
1241
+ this.gatewayRtt = gatewayRtt;
1212
1242
  this.receivedBytes = receivedBytes;
1213
1243
  this.sentBytes = sentBytes;
1214
1244
  this.localStatisticsArray = localStatisticsArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.3.8-beta.0",
3
+ "version": "9.3.109-beta.0",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",