trtc-electron-sdk 9.3.105-beta.2 → 9.3.111-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
@@ -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 对象单例
@@ -793,8 +794,6 @@ declare class TRTCCloud extends EventEmitter {
793
794
  *
794
795
  * 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
795
796
  *
796
- * 注意:混流转码为收费功能,调用接口将产生云端混流转码费用,详见 [云端混流转码计费说明](https://cloud.tencent.com/document/product/647/49446)。
797
- *
798
797
  * @note 关于云端混流的注意事项:
799
798
  * - 云端转码会引入一定的 CDN 观看延时,大概会增加1 - 2秒。
800
799
  * - 调用该函数的用户,会将连麦中的多路画面混合到自己当前这路画面中。
@@ -1446,7 +1445,7 @@ declare class TRTCCloud extends EventEmitter {
1446
1445
  */
1447
1446
  selectScreenCaptureTarget(type: number, sourceId: string, sourcename: string, captureRect: Rect, captureMouse: boolean, highlightWindow: boolean): any;
1448
1447
  /**
1449
- * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
1448
+ * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。(暂不支持 mac 平台预览界面)
1450
1449
  *
1451
1450
  * 注意:
1452
1451
  * 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
@@ -1518,28 +1517,6 @@ declare class TRTCCloud extends EventEmitter {
1518
1517
  * @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
1519
1518
  */
1520
1519
  removeAllExcludedShareWindow(): void;
1521
- /**
1522
- * 8.16 将指定窗口加入屏幕分享的包含列表中(该接口仅支持桌面系统)
1523
- *
1524
- * @param {String} win - 希望被分享出去的窗口(Windows 平台下为窗口句柄: HWND)
1525
- * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
1526
- * - 您在 startScreenCapture 之前和之后调用均可。
1527
- * - 通过该方法添加到包含列表中的窗口,会在退出房间后被 SDK 自动清除。
1528
- */
1529
- addIncludedShareWindow(win: string): void;
1530
- /**
1531
- * 8.17 将指定窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
1532
- *
1533
- * @param {String} win - 希望被分享出去的窗口(Mac 平台: 窗口 ID;Windows 平台: HWND)
1534
- * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
1535
- */
1536
- removeIncludedShareWindow(win: string): void;
1537
- /**
1538
- * 8.18 将全部窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
1539
- *
1540
- * @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
1541
- */
1542
- removeAllIncludedShareWindow(): void;
1543
1520
  /**
1544
1521
  * @private
1545
1522
  * 9.5 设置本地视频自定义渲染(Electron 平台下不可用)
@@ -1863,7 +1840,7 @@ declare class TRTCCloud extends EventEmitter {
1863
1840
  * 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
1864
1841
  * 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
1865
1842
  *
1866
- * 注意:测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
1843
+ * 注意:测速本身会消耗一定的流量,所以也会产生少量额外的流量费用。
1867
1844
  *
1868
1845
  * @param {Number} sdkAppId - 应用标识
1869
1846
  * @param {String} userId - 用户标识
@@ -1999,6 +1976,7 @@ declare class TRTCCloud extends EventEmitter {
1999
1976
  removePlugin(id: string): void;
2000
1977
  getPluginList(): PluginInfo[];
2001
1978
  createPlugin(pluginId: string): PluginInfo;
1979
+ setPluginCallback(pluginCb: (pluginId: string, errorCode: number, msg: string) => void): void;
2002
1980
  getKey(uid: string, type: TRTCVideoStreamType): string;
2003
1981
  /**
2004
1982
  * 判断是否支持webGL
@@ -2027,5 +2005,6 @@ declare class TRTCCloud extends EventEmitter {
2027
2005
  _YUV2RGBA(width: number, height: number, buffer: ArrayBufferLike): Uint8ClampedArray;
2028
2006
  _BGRA2RGBA(data: ArrayBuffer, width: number, height: number): Uint8ClampedArray;
2029
2007
  _isMacPlatform(): boolean;
2008
+ _isLocalUser(uid: string): boolean;
2030
2009
  }
2031
2010
  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
  }
@@ -418,6 +420,7 @@ class TRTCCloud extends events_1.EventEmitter {
418
420
  */
419
421
  handleOnExitRoom(reason) {
420
422
  this.firstVideoFrameList = [];
423
+ this.isStartLocalPreview = false;
421
424
  this.fire('onExitRoom', reason);
422
425
  }
423
426
  /**
@@ -1335,8 +1338,6 @@ class TRTCCloud extends events_1.EventEmitter {
1335
1338
  *
1336
1339
  * 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
1337
1340
  *
1338
- * 注意:混流转码为收费功能,调用接口将产生云端混流转码费用,详见 [云端混流转码计费说明](https://cloud.tencent.com/document/product/647/49446)。
1339
- *
1340
1341
  * @note 关于云端混流的注意事项:
1341
1342
  * - 云端转码会引入一定的 CDN 观看延时,大概会增加1 - 2秒。
1342
1343
  * - 调用该函数的用户,会将连麦中的多路画面混合到自己当前这路画面中。
@@ -1425,6 +1426,7 @@ class TRTCCloud extends events_1.EventEmitter {
1425
1426
  let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1426
1427
  this._initRender(key, view);
1427
1428
  }
1429
+ this.isStartLocalPreview = true;
1428
1430
  this.rtcCloud.startLocalPreview();
1429
1431
  this.addLocalVideoRenderCallback();
1430
1432
  }
@@ -1439,8 +1441,9 @@ class TRTCCloud extends events_1.EventEmitter {
1439
1441
  let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1440
1442
  this._destroyRender(key, null);
1441
1443
  this.rtcCloud.stopLocalPreview();
1442
- this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
1443
- return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1444
+ this.isStartLocalPreview = false;
1445
+ this.firstVideoFrameList = this.firstVideoFrameList.filter((item) => {
1446
+ return !(this._isLocalUser(item.uid) && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1444
1447
  });
1445
1448
  }
1446
1449
  /**
@@ -2310,7 +2313,7 @@ class TRTCCloud extends events_1.EventEmitter {
2310
2313
  }
2311
2314
  }
2312
2315
  /**
2313
- * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
2316
+ * 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。(暂不支持 mac 平台预览界面)
2314
2317
  *
2315
2318
  * 注意:
2316
2319
  * 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
@@ -2426,34 +2429,6 @@ class TRTCCloud extends events_1.EventEmitter {
2426
2429
  removeAllExcludedShareWindow() {
2427
2430
  this.rtcCloud.removeAllExcludedShareWindow();
2428
2431
  }
2429
- /**
2430
- * 8.16 将指定窗口加入屏幕分享的包含列表中(该接口仅支持桌面系统)
2431
- *
2432
- * @param {String} win - 希望被分享出去的窗口(Windows 平台下为窗口句柄: HWND)
2433
- * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
2434
- * - 您在 startScreenCapture 之前和之后调用均可。
2435
- * - 通过该方法添加到包含列表中的窗口,会在退出房间后被 SDK 自动清除。
2436
- */
2437
- addIncludedShareWindow(win) {
2438
- this.rtcCloud.addIncludedShareWindow(win);
2439
- }
2440
- /**
2441
- * 8.17 将指定窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
2442
- *
2443
- * @param {String} win - 希望被分享出去的窗口(Mac 平台: 窗口 ID;Windows 平台: HWND)
2444
- * - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
2445
- */
2446
- removeIncludedShareWindow(win) {
2447
- this.rtcCloud.removeIncludedShareWindow(win);
2448
- }
2449
- /**
2450
- * 8.18 将全部窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
2451
- *
2452
- * @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
2453
- */
2454
- removeAllIncludedShareWindow() {
2455
- this.rtcCloud.removeAllIncludedShareWindow();
2456
- }
2457
2432
  /////////////////////////////////////////////////////////////////////////////////
2458
2433
  //
2459
2434
  // (九)自定义采集和渲染
@@ -2939,7 +2914,7 @@ class TRTCCloud extends events_1.EventEmitter {
2939
2914
  * 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
2940
2915
  * 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
2941
2916
  *
2942
- * 注意:测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
2917
+ * 注意:测速本身会消耗一定的流量,所以也会产生少量额外的流量费用。
2943
2918
  *
2944
2919
  * @param {Number} sdkAppId - 应用标识
2945
2920
  * @param {String} userId - 用户标识
@@ -2985,8 +2960,8 @@ class TRTCCloud extends events_1.EventEmitter {
2985
2960
  let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2986
2961
  this._destroyRender(key, null);
2987
2962
  this.rtcCloud.stopCameraDeviceTest();
2988
- this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
2989
- return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2963
+ this.firstVideoFrameList = this.firstVideoFrameList.filter((item) => {
2964
+ return !(this._isLocalUser(item.uid) && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
2990
2965
  });
2991
2966
  }
2992
2967
  /**
@@ -3198,9 +3173,15 @@ class TRTCCloud extends events_1.EventEmitter {
3198
3173
  },
3199
3174
  setParameter: (param) => {
3200
3175
  return this.rtcCloud.setPluginParameter(pluginId, param);
3176
+ },
3177
+ getParameter: () => {
3178
+ return this.rtcCloud.getPluginParameter(pluginId);
3201
3179
  }
3202
3180
  };
3203
3181
  }
3182
+ setPluginCallback(pluginCb) {
3183
+ this.rtcCloud.setPluginCallback(pluginCb);
3184
+ }
3204
3185
  getKey(uid, type) {
3205
3186
  return String(uid) + '_' + String(type);
3206
3187
  }
@@ -3239,6 +3220,7 @@ class TRTCCloud extends events_1.EventEmitter {
3239
3220
  return this.streams.get(key);
3240
3221
  }
3241
3222
  _onRenderFrame(uid, type, width, height, timestamp, rotation, data) {
3223
+ const isCurrentLocalUser = this._isLocalUser(uid);
3242
3224
  // 由于 mac 监听自定义渲染回调后不会回调 onFirstVideoFrame ,所以在这里自己实现回调 onFirstVideoFrame
3243
3225
  if (this._isMacPlatform()) {
3244
3226
  setImmediate(() => {
@@ -3246,12 +3228,14 @@ class TRTCCloud extends events_1.EventEmitter {
3246
3228
  return uid === item.uid && type === item.type;
3247
3229
  });
3248
3230
  if (index === -1) {
3249
- this.emit('onFirstVideoFrame', uid, type, width, height);
3250
- this.firstVideoFrameList.push({ uid: uid, type: type });
3231
+ if (!isCurrentLocalUser || this.isStartLocalPreview) {
3232
+ this.emit('onFirstVideoFrame', uid, type, width, height);
3233
+ this.firstVideoFrameList.push({ uid: uid, type: type });
3234
+ }
3251
3235
  }
3252
3236
  });
3253
3237
  }
3254
- if (uid.length == 0) {
3238
+ if (isCurrentLocalUser) {
3255
3239
  if (this.isExternalRenderEnabled) {
3256
3240
  this.fire(CUSTOM_VIDEO_DATA, {
3257
3241
  uid: '', type, rotation, timestamp,
@@ -3492,6 +3476,9 @@ class TRTCCloud extends events_1.EventEmitter {
3492
3476
  _isMacPlatform() {
3493
3477
  return process.platform == 'darwin';
3494
3478
  }
3479
+ _isLocalUser(uid) {
3480
+ return uid === '';
3481
+ }
3495
3482
  }
3496
3483
  class VideoRenderCallback {
3497
3484
  constructor() {
@@ -616,9 +616,6 @@ export declare class TRTCRemoteStatistics {
616
616
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
617
617
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
618
618
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
619
- * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
620
- * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
621
- * 当网络为蜂窝网非 WiFi 类型时,该值无效。
622
619
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
623
620
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
624
621
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -633,14 +630,13 @@ export declare class TRTCStatistics {
633
630
  appCpu: number;
634
631
  systemCpu: number;
635
632
  rtt: number;
636
- gatewayRtt: number;
637
633
  receivedBytes: number;
638
634
  sentBytes: number;
639
635
  localStatisticsArray: TRTCLocalStatistics[];
640
636
  localStatisticsArraySize: number;
641
637
  remoteStatisticsArray: TRTCRemoteStatistics[];
642
638
  remoteStatisticsArraySize: number;
643
- 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);
639
+ constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number);
644
640
  }
645
641
  /**
646
642
  * 音乐参数
@@ -697,4 +693,5 @@ export interface PluginInfo {
697
693
  enable: () => number;
698
694
  disable: () => number;
699
695
  setParameter: (param: string) => number;
696
+ getParameter: (paramKey: string) => string;
700
697
  }
@@ -1194,9 +1194,6 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1194
1194
  * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
1195
1195
  * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
1196
1196
  * 由于数据上下行共享一条网络连接,所以 local 和 remote 的 rtt 相同。
1197
- * @param {Number} gatewayRtt - 延迟(毫秒),指 SDK 到本地路由器网关一次网络往返时间,该值越小越好。
1198
- * 一般低于 50ms 的 gatewayRtt 相对理想,而高于 200ms 的 gatewayRtt 会引入较大的通话延时。
1199
- * 当网络为蜂窝网非 WiFi 类型时,该值无效。
1200
1197
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
1201
1198
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
1202
1199
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
@@ -1206,13 +1203,12 @@ exports.TRTCRemoteStatistics = TRTCRemoteStatistics;
1206
1203
  *
1207
1204
  */
1208
1205
  class TRTCStatistics {
1209
- constructor(upLoss = 0, downLoss = 0, appCpu = 0, systemCpu = 0, rtt = 0, gatewayRtt = 0, receivedBytes = 0, sentBytes = 0, localStatisticsArray = [], localStatisticsArraySize = 0, remoteStatisticsArray = [], remoteStatisticsArraySize = 0) {
1206
+ constructor(upLoss = 0, downLoss = 0, appCpu = 0, systemCpu = 0, rtt = 0, receivedBytes = 0, sentBytes = 0, localStatisticsArray = [], localStatisticsArraySize = 0, remoteStatisticsArray = [], remoteStatisticsArraySize = 0) {
1210
1207
  this.upLoss = upLoss;
1211
1208
  this.downLoss = downLoss;
1212
1209
  this.appCpu = appCpu;
1213
1210
  this.systemCpu = systemCpu;
1214
1211
  this.rtt = rtt;
1215
- this.gatewayRtt = gatewayRtt;
1216
1212
  this.receivedBytes = receivedBytes;
1217
1213
  this.sentBytes = sentBytes;
1218
1214
  this.localStatisticsArray = localStatisticsArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.3.105-beta.2",
3
+ "version": "9.3.111-beta.0",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",