@tencent-rtc/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 (59) hide show
  1. package/index.js +4 -0
  2. package/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/resource/doc/chatuikit/faq/web_sdk/faq.md +125 -0
  5. package/resource/doc/chatuikit/flutter/faq.md +17 -114
  6. package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +86 -722
  7. package/resource/doc/chatuikit/react/integration.md +430 -49
  8. package/resource/doc/chatuikit/react/workflow.md +258 -0
  9. package/resource/doc/chatuikit/vue/integration.md +355 -144
  10. package/resource/doc/chatuikit/vue/workflow.md +395 -0
  11. package/resource/doc/roomkit/vue/features/call-user-to-room.md +256 -0
  12. package/resource/doc/roomkit/vue/features/device-detection.md +388 -0
  13. package/resource/doc/roomkit/vue/features/device-state.md +480 -0
  14. package/resource/doc/roomkit/vue/features/free-beauty-panel.md +238 -0
  15. package/resource/doc/roomkit/vue/features/room-chat.md +427 -0
  16. package/resource/doc/roomkit/vue/features/room-participant-state.md +407 -0
  17. package/resource/doc/roomkit/vue/features/room-state.md +291 -0
  18. package/resource/doc/roomkit/vue/features/room-view.md +338 -0
  19. package/resource/doc/roomkit/vue/features/schedule-room.md +349 -0
  20. package/resource/doc/roomkit/vue/features/screen-share.md +333 -0
  21. package/resource/doc/roomkit/vue/features/virtual-background.md +287 -0
  22. package/resource/doc/roomkit/vue/features/workflow.md +553 -0
  23. package/resource/doc/roomkit/vue/integration.md +479 -0
  24. package/resource/doc/roomkit/vue/workflow.md +487 -0
  25. package/resource/doc/tuicallkit/react/api.md +21 -0
  26. package/resource/doc/tuicallkit/vue/api.md +21 -0
  27. package/tools/chat/get-web-chat-integration.js +31 -14
  28. package/tools/chat/get-web-chat-integration.js.map +1 -1
  29. package/tools/definitions/get_web_chat_uikit_integration_def.js +19 -12
  30. package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -1
  31. package/tools/definitions/get_web_room_feature_detail_def.js +95 -0
  32. package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -0
  33. package/tools/definitions/get_web_room_uikit_integration_def.js +44 -0
  34. package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -0
  35. package/tools/index.js +4 -4
  36. package/tools/index.js.map +1 -1
  37. package/tools/live/get-web-live-uikit-integration.js +1 -1
  38. package/tools/room/get-web-room-feature-detail.js +68 -0
  39. package/tools/room/get-web-room-feature-detail.js.map +1 -0
  40. package/tools/room/get-web-room-integration.js +43 -0
  41. package/tools/room/get-web-room-integration.js.map +1 -0
  42. package/utils/generate-structured-result.js +2 -2
  43. package/utils/generate-structured-result.js.map +1 -1
  44. package/utils/report-cls-client.js +1 -1
  45. package/utils/report-es-client.js +1 -1
  46. package/resource/doc/chatuikit/flutter/integrate_only_tuichat_Flutter.md +0 -333
  47. package/resource/doc/chatuikit/flutter/quick_start_Flutter.md +0 -217
  48. package/resource/doc/chatuikit/react/chat_window_integration.md +0 -94
  49. package/resource/doc/chatuikit/vue/chat_window_integration.md +0 -156
  50. package/resource/doc/roomkit/vue/states/device-state.md +0 -369
  51. package/resource/doc/roomkit/vue/states/login-state.md +0 -59
  52. package/resource/doc/roomkit/vue/states/room-list-state.md +0 -355
  53. package/resource/doc/roomkit/vue/states/room-participant-state.md +0 -388
  54. package/tools/chat/get-web-chat-window-integration.js +0 -28
  55. package/tools/chat/get-web-chat-window-integration.js.map +0 -1
  56. package/tools/definitions/get_web_chat_window_integration_def.js +0 -26
  57. package/tools/definitions/get_web_chat_window_integration_def.js.map +0 -1
  58. package/tools/room/get-web-room-state-detail.js +0 -31
  59. package/tools/room/get-web-room-state-detail.js.map +0 -1
@@ -0,0 +1,388 @@
1
+ This document will guide you on how to provide device preview and testing functionality before users join a room. Through the pre-room testing interfaces provided by Atomicx, you can guide users to check and adjust their audio/video device status, ensuring they enter the multi-party audio/video room in the best condition.
2
+
3
+ ## Feature Introduction
4
+
5
+ Device preview is an important part of ensuring the smooth operation of audio/video rooms. Atomicx provides a dedicated set of testing interfaces specifically for pre-room scenarios, with core capabilities including:
6
+ - **Video Preview**: Start the camera without streaming to verify picture clarity and lighting.
7
+
8
+ - **Microphone Detection**: Confirm microphone capture is working properly through real-time volume feedback.
9
+
10
+ - **Speaker Calibration**: Confirm output device and volume settings by playing test audio.
11
+
12
+
13
+ ## Prerequisites
14
+ - User has completed login authentication through [useLoginState](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-LoginState), please refer to [Integration Overview](https://write.woa.com/document/197379797539790848).
15
+
16
+
17
+ ## Implementing Device Detection Features
18
+
19
+ ### Step 1: Camera Test
20
+
21
+ Use the [startCameraTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startCameraTest) method to start camera testing. This method is only used for local preview and does not generate network traffic.
22
+
23
+ **Code Example:**
24
+ ``` typescript
25
+ <template>
26
+ <div class="preview-container">
27
+ <!-- Camera preview area -->
28
+ <div id="camera-preview" class="camera-preview">
29
+ <!-- Loading status -->
30
+ <div v-if="isCameraTestLoading" class="loading-overlay">
31
+ <div class="loading-spinner" />
32
+ <span>Starting camera...</span>
33
+ </div>
34
+ </div>
35
+
36
+ <!-- Camera selection -->
37
+ <div class="camera-selector">
38
+ <label>Select Camera</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
+ <!-- Control buttons -->
55
+ <div class="control-buttons">
56
+ <button @click="getCameraList">Get Camera List</button>
57
+ <button
58
+ @click="toggleCameraTest"
59
+ :disabled="isCameraTestLoading"
60
+ >
61
+ {{ isCameraTesting ? 'Stop Preview' : 'Start Preview' }}
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('Failed to switch camera:', 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
+ ### Step 2: Microphone Test
121
+
122
+ Start microphone testing through [startMicrophoneTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startMicrophoneTest), and use [testingMicVolume](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#testingMicVolume) to implement real-time volume bar fluctuation in the UI.
123
+
124
+ **Code Example:**
125
+ ``` typescript
126
+ <template>
127
+ <div class="microphone-test">
128
+ <!-- Volume display -->
129
+ <div class="volume-display">
130
+ <div class="volume-label">Microphone Volume</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
+ <!-- Microphone selection -->
142
+ <div class="microphone-selector">
143
+ <label>Select Microphone</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
+ <!-- Control buttons -->
160
+ <div class="control-buttons">
161
+ <button
162
+ @click="getMicrophoneList"
163
+ >
164
+ Get Devices
165
+ </button>
166
+ <button
167
+ @click="toggleMicrophoneTest"
168
+ >
169
+ {{ isMicrophoneTesting ? 'Stop Test' : 'Start Test' }}
170
+ </button>
171
+ </div>
172
+
173
+ <!-- Test tip -->
174
+ <div v-if="isMicrophoneTesting" class="test-tip">
175
+ <span>Please speak into the microphone to see volume changes</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
+ // Volume bar style class
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
+ // Cleanup: stop testing
208
+ onUnmounted(() => {
209
+ if (isMicrophoneTesting.value) {
210
+ stopMicrophoneTest();
211
+ }
212
+ });
213
+
214
+ // Toggle microphone test
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('Failed to start microphone test:', error);
223
+ }
224
+ }
225
+ };
226
+
227
+ // Switch microphone device
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('Failed to switch microphone:', 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
+ ### Step 3: Speaker Test
244
+
245
+ Use the [startSpeakerTest](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#startSpeakerTest) method to play a specified audio file to confirm whether the speaker is working properly.
246
+
247
+ **Code Example:**
248
+ ``` typescript
249
+ <template>
250
+ <div class="speaker-test">
251
+ <!-- Speaker selection -->
252
+ <div class="speaker-selector">
253
+ <label>Select Speaker</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
+ <!-- Control buttons -->
270
+ <div class="control-buttons">
271
+ <button @click="getSpeakerList">Get Speaker List</button>
272
+ <button
273
+ @click="toggleSpeakerTest"
274
+ :disabled="isSpeakerTesting"
275
+ >
276
+ {{ isSpeakerTesting ? 'Playing...' : 'Play Test Audio' }}
277
+ </button>
278
+ <button
279
+ v-if="isSpeakerTesting"
280
+ @click="stopSpeakerTest"
281
+ >
282
+ Stop Playback
283
+ </button>
284
+ </div>
285
+
286
+ <!-- Test tip -->
287
+ <div v-if="isSpeakerTesting" class="test-tip">
288
+ <span>Playing test audio, please confirm if you can hear the sound</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
+ // Test audio file path
308
+ // Note: This URL is for development testing only. For production environments, please use your own audio file. It is recommended to use a 3-5 second MP3 format audio file
309
+ const testAudioPath = 'https://web.sdk.qcloud.com/trtc/electron/download/resources/media/TestSpeaker.mp3';
310
+
311
+ // Cleanup: stop testing
312
+ onUnmounted(() => {
313
+ if (isSpeakerTesting.value) {
314
+ stopSpeakerTest();
315
+ }
316
+ });
317
+
318
+ // Toggle speaker test
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('Failed to start speaker test:', error);
327
+ }
328
+ }
329
+ };
330
+
331
+ // Switch speaker device
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('Failed to switch speaker:', 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 Documentation
348
+ <table>
349
+ <tr>
350
+ <td rowspan="1" colSpan="1" >**State/Component**</td>
351
+
352
+ <td rowspan="1" colSpan="1" >**Feature Description**</td>
353
+
354
+ <td rowspan="1" colSpan="1" >**API Documentation**</td>
355
+ </tr>
356
+
357
+ <tr>
358
+ <td rowspan="1" colSpan="1" >**useDeviceState**</td>
359
+
360
+ <td rowspan="1" colSpan="1" >Contains audio/video device status, audio/video device list and operation interfaces.</td>
361
+
362
+ <td rowspan="1" colSpan="1" >[API Documentation](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState)</td>
363
+ </tr>
364
+ </table>
365
+
366
+
367
+ ## FAQ
368
+
369
+ ### Why is there no image in the camera preview?
370
+
371
+ Possible reasons include:
372
+ - **Permission denied:** Check if the browser allows camera permissions.
373
+
374
+ - **Device occupied:** Close other applications using the camera.
375
+
376
+ - **Device not connected:** Check if the camera is properly connected.
377
+
378
+ - **Browser not supported:** Use modern browsers such as Chrome, Edge, etc.
379
+
380
+
381
+ ### Microphone test volume is always 0?
382
+
383
+ Possible reasons include:
384
+ - **Microphone permission not granted:** Check browser permission settings.
385
+
386
+ - **Microphone is muted:** Check system microphone settings.
387
+
388
+ - **Wrong device selected:** Switch to the correct microphone device.