@tencentcloud/sdk-mcp 1.3.0 → 1.3.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.
Files changed (67) hide show
  1. package/index.js +5 -1
  2. package/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/resource/doc/chatuikit/faq/web_sdk/faq.md +117 -0
  5. package/resource/doc/chatuikit/flutter/client_api_Flutter.md +100 -179
  6. package/resource/doc/chatuikit/flutter/faq.md +17 -112
  7. package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +272 -1281
  8. package/resource/doc/chatuikit/react/integration.md +516 -48
  9. package/resource/doc/chatuikit/react/workflow.md +254 -0
  10. package/resource/doc/chatuikit/uniapp-app/faq.md +0 -0
  11. package/resource/doc/chatuikit/uniapp-app/integration.md +619 -0
  12. package/resource/doc/chatuikit/uniapp-app/workflow.md +576 -0
  13. package/resource/doc/chatuikit/vue/integration.md +511 -129
  14. package/resource/doc/chatuikit/vue/workflow.md +395 -0
  15. package/resource/doc/roomkit/vue/features/call-user-to-room.md +256 -0
  16. package/resource/doc/roomkit/vue/features/device-detection.md +388 -0
  17. package/resource/doc/roomkit/vue/features/device-state.md +480 -0
  18. package/resource/doc/roomkit/vue/features/free-beauty-panel.md +238 -0
  19. package/resource/doc/roomkit/vue/features/room-chat.md +427 -0
  20. package/resource/doc/roomkit/vue/features/room-participant-state.md +407 -0
  21. package/resource/doc/roomkit/vue/features/room-state.md +291 -0
  22. package/resource/doc/roomkit/vue/features/room-view.md +338 -0
  23. package/resource/doc/roomkit/vue/features/schedule-room.md +349 -0
  24. package/resource/doc/roomkit/vue/features/screen-share.md +333 -0
  25. package/resource/doc/roomkit/vue/features/virtual-background.md +281 -0
  26. package/resource/doc/roomkit/vue/features/workflow.md +553 -0
  27. package/resource/doc/roomkit/vue/integration.md +479 -0
  28. package/resource/doc/roomkit/vue/workflow.md +487 -0
  29. package/resource/doc/tuicallkit/react/api.md +16 -0
  30. package/resource/doc/tuicallkit/vue/api.md +16 -0
  31. package/tools/chat/get-web-chat-integration.js +31 -14
  32. package/tools/chat/get-web-chat-integration.js.map +1 -1
  33. package/tools/definitions/get_web_chat_uikit_integration_def.js +18 -11
  34. package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -1
  35. package/tools/definitions/get_web_live_uikit_integration_def.js +1 -1
  36. package/tools/definitions/get_web_room_feature_detail_def.js +95 -0
  37. package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -0
  38. package/tools/definitions/get_web_room_uikit_integration_def.js +44 -0
  39. package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -0
  40. package/tools/definitions/present_framework_choice_def.js +1 -1
  41. package/tools/definitions/record_result_def.js +1 -1
  42. package/tools/definitions/record_result_def.js.map +1 -1
  43. package/tools/index.js +4 -4
  44. package/tools/index.js.map +1 -1
  45. package/tools/live/get-web-live-uikit-integration.js +1 -1
  46. package/tools/room/get-web-room-feature-detail.js +68 -0
  47. package/tools/room/get-web-room-feature-detail.js.map +1 -0
  48. package/tools/room/get-web-room-integration.js +43 -0
  49. package/tools/room/get-web-room-integration.js.map +1 -0
  50. package/utils/generate-structured-result.js +2 -2
  51. package/utils/generate-structured-result.js.map +1 -1
  52. package/utils/report-cls-client.js +1 -1
  53. package/utils/report-es-client.js +1 -1
  54. package/resource/doc/chatuikit/react/chat_window_integration.md +0 -83
  55. package/resource/doc/chatuikit/vue/chat_window_integration.md +0 -131
  56. package/resource/doc/roomkit/vue/states/device-state.md +0 -316
  57. package/resource/doc/roomkit/vue/states/login-state.md +0 -51
  58. package/resource/doc/roomkit/vue/states/room-list-state.md +0 -287
  59. package/resource/doc/roomkit/vue/states/room-participant-state.md +0 -307
  60. package/tools/chat/get-web-chat-window-integration.js +0 -28
  61. package/tools/chat/get-web-chat-window-integration.js.map +0 -1
  62. package/tools/definitions/get_web_chat_window_integration_def.js +0 -26
  63. package/tools/definitions/get_web_chat_window_integration_def.js.map +0 -1
  64. package/tools/definitions/get_web_room_state_detail_def.js +0 -19
  65. package/tools/definitions/get_web_room_state_detail_def.js.map +0 -1
  66. package/tools/room/get-web-room-state-detail.js +0 -31
  67. package/tools/room/get-web-room-state-detail.js.map +0 -1
@@ -0,0 +1,388 @@
1
+ 本篇文档将指导您如何在用户加入房间前提供设备预览与测试功能。通过 Atomicx 提供的进房前测试接口,您可以引导用户检查并调整音视频设备状态,确保以最佳状态进入多人音视频房间。
2
+
3
+ ## 功能介绍
4
+
5
+ 设备预览是保障音视频房间顺利运行的重要环节。Atomicx 专为进房前场景提供了一套独立的测试接口,其核心能力包括:
6
+ - **视频画面预览**:在不推流的情况下启动摄像头,验证画面清晰度与光线。
7
+
8
+ - **麦克风检测**:通过实时音量反馈,确认麦克风采集是否正常。
9
+
10
+ - **扬声器校准**:通过播放测试音,确认输出设备及其音量设置。
11
+
12
+
13
+ ## 前提条件
14
+ - 用户已经通过 [useLoginState](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-LoginState) 完成登录鉴权,请参考 [接入概览](https://write.woa.com/document/197379797539790848)。
15
+
16
+
17
+ ## 实现设备检测功能
18
+
19
+ ### 步骤1:摄像头测试
20
+
21
+ 使用 [startCameraTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startCameraTest) 方法启动摄像头测试。该方法仅用于本地预览,不会产生网络流量。
22
+
23
+ **代码示例:**
24
+ ``` typescript
25
+ <template>
26
+ <div class="preview-container">
27
+ <!-- 摄像头预览区域 -->
28
+ <div id="camera-preview" class="camera-preview">
29
+ <!-- 加载状态 -->
30
+ <div v-if="isCameraTestLoading" class="loading-overlay">
31
+ <div class="loading-spinner" />
32
+ <span>正在启动摄像头...</span>
33
+ </div>
34
+ </div>
35
+
36
+ <!-- 摄像头选择 -->
37
+ <div class="camera-selector">
38
+ <label>选择摄像头</label>
39
+ <select
40
+ :value="currentCamera?.deviceId"
41
+ @change="handleCameraChange"
42
+ :disabled="isCameraTestLoading"
43
+ >
44
+ <option
45
+ v-for="camera in cameraList"
46
+ :key="camera.deviceId"
47
+ :value="camera.deviceId"
48
+ >
49
+ {{ camera.deviceName }}
50
+ </option>
51
+ </select>
52
+ </div>
53
+
54
+ <!-- 控制按钮 -->
55
+ <div class="control-buttons">
56
+ <button @click="getCameraList">获取摄像头列表</button>
57
+ <button
58
+ @click="toggleCameraTest"
59
+ :disabled="isCameraTestLoading"
60
+ >
61
+ {{ isCameraTesting ? '停止预览' : '开始预览' }}
62
+ </button>
63
+ </div>
64
+ </div>
65
+ </template>
66
+
67
+ <script setup lang="ts">
68
+ import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
69
+ import { IconWarning } from '@tencentcloud/uikit-base-component-vue3';
70
+ import {
71
+ useLoginState,
72
+ useDeviceState,
73
+ DeviceStatus,
74
+ DeviceError,
75
+ } from 'tuikit-atomicx-vue3/room';
76
+
77
+ const {
78
+ isCameraTesting,
79
+ isCameraTestLoading,
80
+ cameraList,
81
+ currentCamera,
82
+ startCameraTest,
83
+ stopCameraTest,
84
+ getCameraList,
85
+ setCurrentCamera
86
+ } = useDeviceState();
87
+
88
+ onUnmounted(() => {
89
+ if (isCameraTesting.value) {
90
+ stopCameraTest();
91
+ }
92
+ });
93
+
94
+ const toggleCameraTest = async () => {
95
+ if (isCameraTesting.value) {
96
+ await stopCameraTest();
97
+ } else {
98
+ const previewElement = document.getElementById('camera-preview');
99
+ if (previewElement) {
100
+ await startCameraTest({ view: previewElement });
101
+ }
102
+ }
103
+ };
104
+
105
+ const handleCameraChange = async (event: Event) => {
106
+ const deviceId = (event.target as HTMLSelectElement).value;
107
+ try {
108
+ await setCurrentCamera({ deviceId });
109
+ } catch (error) {
110
+ console.error('切换摄像头失败:', error);
111
+ }
112
+ };
113
+ </script>
114
+
115
+ <style scoped>
116
+ .preview-container { position: relative; width: 100%; max-width: 640px; margin: 0 auto;}.camera-preview { width: 100%; position: relative; aspect-ratio: 16 / 9; background-color: #000; border-radius: 8px; overflow: hidden;}.loading-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background-color: rgba(0, 0, 0, 0.7); color: white; border-radius: 8px;}.loading-spinner { width: 40px; height: 40px; border: 4px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite;}@keyframes spin { to { transform: rotate(360deg); }}.error-message { display: flex; align-items: center; gap: 8px; padding: 12px; margin-top: 12px; background-color: #ffebee; color: #c62828; border-radius: 4px; font-size: 14px;}.camera-selector { margin-top: 16px; display: flex; align-items: center; gap: 12px;}.camera-selector label { font-weight: 500; min-width: 80px;}.camera-selector select { flex: 1; padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px;}.control-buttons { margin-top: 16px; display: flex; gap: 12px;}.control-buttons button { flex: 1; padding: 12px 24px; background-color: #1976d2; color: white; border: none; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.3s;}.control-buttons button:hover:not(:disabled) { background-color: #1565c0;}.control-buttons button:disabled { background-color: #bdbdbd; cursor: not-allowed;}
117
+ </style>
118
+ ```
119
+
120
+ ### 步骤2:麦克风测试
121
+
122
+ 通过 [startMicrophoneTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startMicrophoneTest) 启动麦克风测试,并利用 [testingMicVolume](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#testingMicVolume) 实现 UI 音量条的实时波动。
123
+
124
+ **代码示例:**
125
+ ``` typescript
126
+ <template>
127
+ <div class="microphone-test">
128
+ <!-- 音量显示 -->
129
+ <div class="volume-display">
130
+ <div class="volume-label">麦克风音量</div>
131
+ <div class="volume-bar-container">
132
+ <div
133
+ class="volume-bar"
134
+ :style="{ width: `${testingMicVolume}%` }"
135
+ :class="volumeClass"
136
+ />
137
+ </div>
138
+ <div class="volume-value">{{ testingMicVolume }}</div>
139
+ </div>
140
+
141
+ <!-- 麦克风选择 -->
142
+ <div class="microphone-selector">
143
+ <label>选择麦克风</label>
144
+ <select
145
+ :value="currentMicrophone?.deviceId"
146
+ @change="handleMicrophoneChange"
147
+ :disabled="isMicrophoneTesting"
148
+ >
149
+ <option
150
+ v-for="mic in microphoneList"
151
+ :key="mic.deviceId"
152
+ :value="mic.deviceId"
153
+ >
154
+ {{ mic.deviceName }}
155
+ </option>
156
+ </select>
157
+ </div>
158
+
159
+ <!-- 控制按钮 -->
160
+ <div class="control-buttons">
161
+ <button
162
+ @click="getMicrophoneList"
163
+ >
164
+ 获取设备
165
+ </button>
166
+ <button
167
+ @click="toggleMicrophoneTest"
168
+ >
169
+ {{ isMicrophoneTesting ? '停止测试' : '开始测试' }}
170
+ </button>
171
+ </div>
172
+
173
+ <!-- 测试提示 -->
174
+ <div v-if="isMicrophoneTesting" class="test-tip">
175
+ <span>请对着麦克风说话,查看音量变化</span>
176
+ </div>
177
+ </div>
178
+ </template>
179
+
180
+ <script setup lang="ts">
181
+ import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
182
+ import {
183
+ useDeviceState,
184
+ DeviceError,
185
+ } from 'tuikit-atomicx-vue3/room';
186
+
187
+ const {
188
+ isMicrophoneTesting,
189
+ testingMicVolume,
190
+ microphoneList,
191
+ currentMicrophone,
192
+ startMicrophoneTest,
193
+ stopMicrophoneTest,
194
+ getMicrophoneList,
195
+ setCurrentMicrophone
196
+ } = useDeviceState();
197
+
198
+ // 音量条样式类
199
+ const volumeClass = computed(() => {
200
+ const volume = testingMicVolume.value;
201
+ if (volume === 0) return 'volume-zero';
202
+ if (volume < 30) return 'volume-low';
203
+ if (volume < 70) return 'volume-medium';
204
+ return 'volume-high';
205
+ });
206
+
207
+ // 清理:停止测试
208
+ onUnmounted(() => {
209
+ if (isMicrophoneTesting.value) {
210
+ stopMicrophoneTest();
211
+ }
212
+ });
213
+
214
+ // 切换麦克风测试
215
+ const toggleMicrophoneTest = async () => {
216
+ if (isMicrophoneTesting.value) {
217
+ await stopMicrophoneTest();
218
+ } else {
219
+ try {
220
+ await startMicrophoneTest({ interval: 200 });
221
+ } catch (error) {
222
+ console.error('启动麦克风测试失败:', error);
223
+ }
224
+ }
225
+ };
226
+
227
+ // 切换麦克风设备
228
+ const handleMicrophoneChange = async (event: Event) => {
229
+ const deviceId = (event.target as HTMLSelectElement).value;
230
+ try {
231
+ await setCurrentMicrophone({ deviceId });
232
+ } catch (error) {
233
+ console.error('切换麦克风失败:', error);
234
+ }
235
+ };
236
+ </script>
237
+
238
+ <style scoped>
239
+ .microphone-test { width: 100%; max-width: 640px; margin: 0 auto;}.volume-display { padding: 24px; background-color: #f5f5f5; border-radius: 8px; margin-bottom: 16px;}.volume-label { font-size: 14px; font-weight: 500; color: #666; margin-bottom: 12px;}.volume-bar-container { width: 100%; height: 24px; background-color: #e0e0e0; border-radius: 12px; overflow: hidden; margin-bottom: 8px;}.volume-bar { height: 100%; transition: width 0.1s ease; border-radius: 12px;}.volume-bar.volume-zero { background-color: #9e9e9e;}.volume-bar.volume-low { background-color: #ff9800;}.volume-bar.volume-medium { background-color: #4caf50;}.volume-bar.volume-high { background-color: #2196f3;}.volume-value { text-align: center; font-size: 18px; font-weight: 600; color: #333;}.microphone-selector { display: flex; align-items: center; gap: 12px; margin-bottom: 16px;}.microphone-selector label { font-weight: 500; min-width: 80px;}.microphone-selector select { flex: 1; padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px;}.error-message { display: flex; align-items: center; gap: 8px; padding: 12px; margin-bottom: 16px; background-color: #ffebee; color: #c62828; border-radius: 4px; font-size: 14px;}.control-buttons { margin-bottom: 12px; display: flex; gap: 8px; }.control-buttons button { flex: 1; width: 100%; padding: 12px 24px; background-color: #1976d2; color: white; border: none; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.3s;}.control-buttons button:hover:not(:disabled) { background-color: #1565c0;}.control-buttons button:disabled { background-color: #bdbdbd; cursor: not-allowed;}.test-tip { display: flex; align-items: center; gap: 8px; padding: 12px; background-color: #e3f2fd; color: #1565c0; border-radius: 4px; font-size: 13px;}
240
+ </style>
241
+ ```
242
+
243
+ ### 步骤3:扬声器测试
244
+
245
+ 使用 [startSpeakerTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startSpeakerTest) 方法播放一段指定的音频文件来确认扬声器是否工作正常。
246
+
247
+ **代码示例:**
248
+ ``` typescript
249
+ <template>
250
+ <div class="speaker-test">
251
+ <!-- 扬声器选择 -->
252
+ <div class="speaker-selector">
253
+ <label>选择扬声器</label>
254
+ <select
255
+ :value="currentSpeaker?.deviceId"
256
+ @change="handleSpeakerChange"
257
+ :disabled="isSpeakerTesting"
258
+ >
259
+ <option
260
+ v-for="speaker in speakerList"
261
+ :key="speaker.deviceId"
262
+ :value="speaker.deviceId"
263
+ >
264
+ {{ speaker.deviceName }}
265
+ </option>
266
+ </select>
267
+ </div>
268
+
269
+ <!-- 控制按钮 -->
270
+ <div class="control-buttons">
271
+ <button @click="getSpeakerList">获取扬声器列表</button>
272
+ <button
273
+ @click="toggleSpeakerTest"
274
+ :disabled="isSpeakerTesting"
275
+ >
276
+ {{ isSpeakerTesting ? '正在播放...' : '播放测试音频' }}
277
+ </button>
278
+ <button
279
+ v-if="isSpeakerTesting"
280
+ @click="stopSpeakerTest"
281
+ >
282
+ 停止播放
283
+ </button>
284
+ </div>
285
+
286
+ <!-- 测试提示 -->
287
+ <div v-if="isSpeakerTesting" class="test-tip">
288
+ <span>正在播放测试音频,请确认是否能听到声音</span>
289
+ </div>
290
+ </div>
291
+ </template>
292
+
293
+ <script setup lang="ts">
294
+ import { ref, onMounted, onUnmounted } from 'vue';
295
+ import { useDeviceState } from 'tuikit-atomicx-vue3/room';
296
+
297
+ const {
298
+ isSpeakerTesting,
299
+ speakerList,
300
+ currentSpeaker,
301
+ startSpeakerTest,
302
+ stopSpeakerTest,
303
+ getSpeakerList,
304
+ setCurrentSpeaker,
305
+ } = useDeviceState();
306
+
307
+ // 测试音频文件路径
308
+ // 注意:此 URL 仅供开发测试使用,生产环境请使用您自己的音频文件,建议使用 3-5 秒的 MP3 格式音频文件
309
+ const testAudioPath = 'https://web.sdk.qcloud.com/trtc/electron/download/resources/media/TestSpeaker.mp3';
310
+
311
+ // 清理:停止测试
312
+ onUnmounted(() => {
313
+ if (isSpeakerTesting.value) {
314
+ stopSpeakerTest();
315
+ }
316
+ });
317
+
318
+ // 切换扬声器测试
319
+ const toggleSpeakerTest = async () => {
320
+ if (isSpeakerTesting.value) {
321
+ await stopSpeakerTest();
322
+ } else {
323
+ try {
324
+ await startSpeakerTest({ filePath: testAudioPath });
325
+ } catch (error) {
326
+ console.error('启动扬声器测试失败:', error);
327
+ }
328
+ }
329
+ };
330
+
331
+ // 切换扬声器设备
332
+ const handleSpeakerChange = async (event: Event) => {
333
+ const deviceId = (event.target as HTMLSelectElement).value;
334
+ try {
335
+ await setCurrentSpeaker({ deviceId });
336
+ } catch (error) {
337
+ console.error('切换扬声器失败:', error);
338
+ }
339
+ };
340
+ </script>
341
+
342
+ <style scoped>
343
+ .speaker-test { width: 100%; max-width: 640px; margin: 0 auto;}.speaker-selector { display: flex; align-items: center; gap: 12px; margin-bottom: 24px;}.speaker-selector label { font-weight: 500; min-width: 80px;}.speaker-selector select { flex: 1; padding: 8px 12px; border: 1px solid #e0e0e0; border-radius: 4px; font-size: 14px;}.volume-slider-container { display: flex; align-items: center; gap: 12px;}.volume-slider { flex: 1; height: 6px; border-radius: 3px; background: #e0e0e0; outline: none; -webkit-appearance: none;}.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #1976d2; cursor: pointer;}.volume-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #1976d2; cursor: pointer; border: none;}.volume-value { min-width: 50px; text-align: right; font-weight: 500; color: #333;}.control-buttons { display: flex; gap: 12px; margin-bottom: 12px;}button { flex: 1; padding: 12px 24px; background-color: #1976d2; color: white; border: none; border-radius: 4px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 0.3s;}.control-buttons button:hover:not(:disabled) { background-color: #1565c0;}.control-buttons button:disabled { background-color: #bdbdbd; cursor: not-allowed;}.test-tip { display: flex; align-items: center; gap: 8px; padding: 12px; background-color: #e3f2fd; color: #1565c0; border-radius: 4px; font-size: 13px;}
344
+ </style>
345
+ ```
346
+
347
+ ## API 文档
348
+ <table>
349
+ <tr>
350
+ <td rowspan="1" colSpan="1" >**State/Component**</td>
351
+
352
+ <td rowspan="1" colSpan="1" >**功能描述**</td>
353
+
354
+ <td rowspan="1" colSpan="1" >**API 文档**</td>
355
+ </tr>
356
+
357
+ <tr>
358
+ <td rowspan="1" colSpan="1" >**useDeviceState**</td>
359
+
360
+ <td rowspan="1" colSpan="1" >包含音视频设备状态,音视频设备列表及操作接口。</td>
361
+
362
+ <td rowspan="1" colSpan="1" >[API 文档](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState)</td>
363
+ </tr>
364
+ </table>
365
+
366
+
367
+ ## 常见问题
368
+
369
+ ### 为什么摄像头预览没有画面?
370
+
371
+ 可能的原因包括:
372
+ - **权限被拒绝:**检查浏览器是否允许摄像头权限。
373
+
374
+ - **设备被占用:**关闭其他使用摄像头的应用。
375
+
376
+ - **设备未连接:**检查摄像头是否正确连接。
377
+
378
+ - **浏览器不支持:**使用 Chrome、Edge 等现代浏览器。
379
+
380
+
381
+ ### 麦克风测试时音量一直为 0?
382
+
383
+ 可能的原因包括:
384
+ - **麦克风权限未授予:**检查浏览器权限设置。
385
+
386
+ - **麦克风被静音:**检查系统麦克风设置。
387
+
388
+ - **设备选择错误:**切换到正确的麦克风设备。