trtc-sdk-v5 5.2.1 → 5.3.0-beta.1

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/index.d.ts CHANGED
@@ -410,7 +410,7 @@
410
410
  * @example
411
411
  *
412
412
  * trtc.on(TRTC.EVENT.ERROR, error => {
413
- * console.error('client error observed: ' + error);
413
+ * console.error('trtc error observed: ' + error);
414
414
  * const errorCode = error.code;
415
415
  * const extraCode = error.extraCode;
416
416
  * });
@@ -531,7 +531,7 @@
531
531
  readonly REMOTE_VIDEO_UNAVAILABLE: "remote-video-unavailable";
532
532
  /**
533
533
  * @description 音量大小事件<br>
534
- * 调用 {@link Client#enableAudioVolumeEvaluation enableAudioVolumeEvaluation} 接口开启音量大小回调后,SDK 会定时抛出该事件,通知每个 userId 的音量大小。<br>
534
+ * 调用 {@link TRTC#enableAudioVolumeEvaluation enableAudioVolumeEvaluation} 接口开启音量大小回调后,SDK 会定时抛出该事件,通知每个 userId 的音量大小。<br>
535
535
  * **Note**
536
536
  * - 回调中包含本地麦克风音量及远端用户的音量,无论是否有人说话,都会触发该回调。
537
537
  * - 回调 event.result 会根据音量大小,按大到小进行排序。
@@ -563,7 +563,7 @@
563
563
  * 其枚举值及含义如下表所示:
564
564
  * | 数值 | 含义 |
565
565
  * | :--- | :---- |
566
- * | 0 | 网络状况未知,表示当前 client 实例还没有建立上行/下行连接 |
566
+ * | 0 | 网络状况未知,表示当前 trtc 实例还没有建立上行/下行连接 |
567
567
  * | 1 | 网络状况极佳 |
568
568
  * | 2 | 网络状况较好|
569
569
  * | 3 | 网络状况一般 |
@@ -604,7 +604,7 @@
604
604
  * @default 'connection-state-changed'
605
605
  * @memberof module:EVENT
606
606
  * @example
607
- * client.on(TRTC.CONNECTION_STATE_CHANGED, event => {
607
+ * trtc.on(TRTC.CONNECTION_STATE_CHANGED, event => {
608
608
  * const prevState = event.prevState;
609
609
  * const curState = event.state;
610
610
  * });
@@ -1116,15 +1116,22 @@
1116
1116
  * await trtc.updateLocalVideo({ publish:true });
1117
1117
  * @example <caption>示例 3:预览及发布指定的摄像头</caption>
1118
1118
  * // 使用指定的摄像头。
1119
+ * // 在 DOM 中的 elementId 为 localVideo 的标签上预览视频。
1120
+ * const view = document.getElementById('localVideo');
1119
1121
  * const cameraList = await TRTC.getCameraList();
1120
1122
  * if (cameraList[0]) {
1121
1123
  * await trtc.startLocalVideo({
1122
- * view: document.getElementById('localVideo'), // 在 DOM 中的 elementId 为 localVideo 的标签上预览视频。
1124
+ * view,
1123
1125
  * option: {
1124
1126
  * cameraId: cameraList[0].deviceId,
1125
1127
  * }
1126
1128
  * });
1127
1129
  * }
1130
+ *
1131
+ * // 在移动端指定使用前置摄像头
1132
+ * await trtc.startLocalVideo({ view, option: { useFrontCamera: true }});
1133
+ * // 在移动端指定使用后置摄像头
1134
+ * await trtc.startLocalVideo({ view, option: { useFrontCamera: false }});
1128
1135
  * @memberof TRTC
1129
1136
  */
1130
1137
  startLocalVideo(config?: LocalVideoConfig): Promise<void>;
@@ -1559,8 +1566,24 @@
1559
1566
  * <br>
1560
1567
  * **Note**
1561
1568
  * - 该接口不支持在 http 协议下使用,请使用 https 协议部署您的网站。{@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
1562
- * - 出于安全的考虑,在用户未授权摄像头或麦克风访问权限前,label 及 deviceId 字段可能都是空的。因此建议在用户授权访问后,
1563
- * 再调用该接口获取设备详情。
1569
+ * - 出于安全的考虑,在用户未授权摄像头或麦克风访问权限前,label 及 deviceId 字段可能都是空的。因此建议在用户授权访问后,再调用该接口获取设备详情。
1570
+ * - 可以调用浏览器原生接口 [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) 获取摄像头支持的最大分辨率、帧率、移动端设备区分前后置摄像头等。该接口支持 Chrome 67+, Edge 79+, Safari 17+, Opera 54+ 浏览器。
1571
+ * @example
1572
+ * const cameraList = await TRTC.getCameraList();
1573
+ * if (cameraList[0] && cameraList[0].getCapabilities) {
1574
+ * const { width, height, frameRate, facingMode } = cameraList[0].getCapabilities();
1575
+ * // 摄像头支持的最大分辨率、帧率。
1576
+ * console.log(width.max, height.max, frameRate.max);
1577
+ *
1578
+ * // 在移动端区分该摄像头是前置还是后置。
1579
+ * if (facingMode) {
1580
+ * if (facingMode[0] === 'user') {
1581
+ * // 前置摄像头
1582
+ * } else if (facingMode[0] === 'environment') {
1583
+ * // 后置摄像头
1584
+ * }
1585
+ * }
1586
+ * }
1564
1587
  * @returns {Promise.<MediaDeviceInfo[]>} Promise 返回 {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo} 数组
1565
1588
  */
1566
1589
  static getCameraList(): Promise<DeviceInfo[]>;
@@ -1569,8 +1592,14 @@
1569
1592
  * <br>
1570
1593
  * **Note**
1571
1594
  * - 该接口不支持在 http 协议下使用,请使用 https 协议部署您的网站。{@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Privacy_and_security Privacy and security}
1572
- * - 出于安全的考虑,在用户未授权摄像头或麦克风访问权限前,label 及 deviceId 字段可能都是空的。因此建议在用户授权访问后,
1573
- * 再调用该接口获取设备详情。
1595
+ * - 出于安全的考虑,在用户未授权摄像头或麦克风访问权限前,label 及 deviceId 字段可能都是空的。因此建议在用户授权访问后,再调用该接口获取设备详情。
1596
+ * - 可以调用浏览器原生接口 [getCapabilities](https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities) 获取麦克风能力信息,例如支持的最大声道数等。该接口支持 Chrome 67+, Edge 79+, Safari 17+, Opera 54+ 浏览器。
1597
+ * @example
1598
+ * const microphoneList = await TRTC.getMicrophoneList();
1599
+ * if (microphoneList[0] && microphoneList[0].getCapabilities) {
1600
+ * const { channelCount } = microphoneList[0].getCapabilities();
1601
+ * console.log(channelCount.max);
1602
+ * }
1574
1603
  * @returns {Promise.<MediaDeviceInfo[]>} Promise 返回 {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo|MediaDeviceInfo} 数组
1575
1604
  */
1576
1605
  static getMicrophoneList(): Promise<DeviceInfo[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-sdk-v5",
3
- "version": "5.2.1",
3
+ "version": "5.3.0-beta.1",
4
4
  "description": "Tencent Cloud RTC SDK for Web",
5
5
  "main": "trtc.js",
6
6
  "types": "index.d.ts",