trtc-sdk-v5 5.2.1 → 5.3.0-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.
package/index.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  profile?: keyof typeof videoProfileMap | VideoProfile;
15
15
  fillMode?: 'contain' | 'cover' | 'fill';
16
16
  mirror?: boolean;
17
- small?: keyof typeof videoProfileMap | VideoProfile;
17
+ small?: keyof typeof videoProfileMap | VideoProfile | boolean;
18
18
  qosPreference?: typeof TRTCType.QOS_PREFERENCE_SMOOTH | typeof TRTCType.QOS_PREFERENCE_CLEAR;
19
19
  videoTrack?: MediaStreamTrack;
20
20
  };
@@ -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.2",
4
4
  "description": "Tencent Cloud RTC SDK for Web",
5
5
  "main": "trtc.js",
6
6
  "types": "index.d.ts",