@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.
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/resource/doc/chatuikit/faq/web_sdk/faq.md +125 -0
- package/resource/doc/chatuikit/flutter/faq.md +17 -114
- package/resource/doc/chatuikit/flutter/integrate_tuikit_Flutter.md +86 -722
- package/resource/doc/chatuikit/react/integration.md +430 -49
- package/resource/doc/chatuikit/react/workflow.md +258 -0
- package/resource/doc/chatuikit/vue/integration.md +355 -144
- package/resource/doc/chatuikit/vue/workflow.md +395 -0
- package/resource/doc/roomkit/vue/features/call-user-to-room.md +256 -0
- package/resource/doc/roomkit/vue/features/device-detection.md +388 -0
- package/resource/doc/roomkit/vue/features/device-state.md +480 -0
- package/resource/doc/roomkit/vue/features/free-beauty-panel.md +238 -0
- package/resource/doc/roomkit/vue/features/room-chat.md +427 -0
- package/resource/doc/roomkit/vue/features/room-participant-state.md +407 -0
- package/resource/doc/roomkit/vue/features/room-state.md +291 -0
- package/resource/doc/roomkit/vue/features/room-view.md +338 -0
- package/resource/doc/roomkit/vue/features/schedule-room.md +349 -0
- package/resource/doc/roomkit/vue/features/screen-share.md +333 -0
- package/resource/doc/roomkit/vue/features/virtual-background.md +287 -0
- package/resource/doc/roomkit/vue/features/workflow.md +553 -0
- package/resource/doc/roomkit/vue/integration.md +479 -0
- package/resource/doc/roomkit/vue/workflow.md +487 -0
- package/resource/doc/tuicallkit/react/api.md +21 -0
- package/resource/doc/tuicallkit/vue/api.md +21 -0
- package/tools/chat/get-web-chat-integration.js +31 -14
- package/tools/chat/get-web-chat-integration.js.map +1 -1
- package/tools/definitions/get_web_chat_uikit_integration_def.js +19 -12
- package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -1
- package/tools/definitions/get_web_room_feature_detail_def.js +95 -0
- package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -0
- package/tools/definitions/get_web_room_uikit_integration_def.js +44 -0
- package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -0
- package/tools/index.js +4 -4
- package/tools/index.js.map +1 -1
- package/tools/live/get-web-live-uikit-integration.js +1 -1
- package/tools/room/get-web-room-feature-detail.js +68 -0
- package/tools/room/get-web-room-feature-detail.js.map +1 -0
- package/tools/room/get-web-room-integration.js +43 -0
- package/tools/room/get-web-room-integration.js.map +1 -0
- package/utils/generate-structured-result.js +2 -2
- package/utils/generate-structured-result.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/resource/doc/chatuikit/flutter/integrate_only_tuichat_Flutter.md +0 -333
- package/resource/doc/chatuikit/flutter/quick_start_Flutter.md +0 -217
- package/resource/doc/chatuikit/react/chat_window_integration.md +0 -94
- package/resource/doc/chatuikit/vue/chat_window_integration.md +0 -156
- package/resource/doc/roomkit/vue/states/device-state.md +0 -369
- package/resource/doc/roomkit/vue/states/login-state.md +0 -59
- package/resource/doc/roomkit/vue/states/room-list-state.md +0 -355
- package/resource/doc/roomkit/vue/states/room-participant-state.md +0 -388
- package/tools/chat/get-web-chat-window-integration.js +0 -28
- package/tools/chat/get-web-chat-window-integration.js.map +0 -1
- package/tools/definitions/get_web_chat_window_integration_def.js +0 -26
- package/tools/definitions/get_web_chat_window_integration_def.js.map +0 -1
- package/tools/room/get-web-room-state-detail.js +0 -31
- package/tools/room/get-web-room-state-detail.js.map +0 -1
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
This document guides you on how to use Atomicx components and the `useDeviceState` Hook to manage audio/video device (camera, microphone, speaker) state in meetings, and how to obtain local network quality information.
|
|
2
|
+
|
|
3
|
+
## Feature Introduction
|
|
4
|
+
- **Device Enumeration & Switching:** Supports real-time retrieval of available system device lists and seamless switching.
|
|
5
|
+
|
|
6
|
+
- **Fine-grained State Control:** Provides capabilities for enabling/disabling, muting capture, volume adjustment, and real-time volume monitoring.
|
|
7
|
+
|
|
8
|
+
- **Error Diagnosis:** Real-time feedback on hardware conflicts, missing system permissions, and other abnormal states.
|
|
9
|
+
|
|
10
|
+
- **Network Quality Monitoring:** Provides multi-dimensional network information including latency and packet loss rate.
|
|
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
|
+
- If integrating within an `iframe`, permissions must be declared in the tag.
|
|
17
|
+
|
|
18
|
+
``` typescript
|
|
19
|
+
<iframe allow="microphone; camera;"></iframe>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Implementing Camera Management
|
|
23
|
+
|
|
24
|
+
You can control local camera on/off, switch devices, and monitor capture status and errors through [useDeviceState](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState).
|
|
25
|
+
|
|
26
|
+
### Step 1: Enable/Disable Camera
|
|
27
|
+
|
|
28
|
+
Control camera on/off by calling [openLocalCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#openLocalCamera) and [closeLocalCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#closeLocalCamera) methods.
|
|
29
|
+
``` typescript
|
|
30
|
+
import { useDeviceState, DeviceStatus } from 'tuikit-atomicx-vue3/room';
|
|
31
|
+
const { cameraStatus, openLocalCamera, closeLocalCamera } = useDeviceState();
|
|
32
|
+
const toggleCamera = async () => {
|
|
33
|
+
if (cameraStatus.value === DeviceStatus.On) {
|
|
34
|
+
await closeLocalCamera();
|
|
35
|
+
} else {
|
|
36
|
+
await openLocalCamera();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2: Get/Switch Camera Device
|
|
42
|
+
|
|
43
|
+
#### Desktop Camera Get and Switch Example
|
|
44
|
+
|
|
45
|
+
You can get all available camera devices through [cameraList](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#cameraList), and use [setCurrentCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setCurrentCamera) method to switch the currently used camera.
|
|
46
|
+
``` typescript
|
|
47
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
48
|
+
const { cameraList, currentCamera, getCameraList, setCurrentCamera } = useDeviceState();
|
|
49
|
+
|
|
50
|
+
// Get camera list
|
|
51
|
+
await getCameraList();
|
|
52
|
+
|
|
53
|
+
// Iterate and display available cameras
|
|
54
|
+
cameraList.value.forEach((camera) => {
|
|
55
|
+
console.log(`Camera: ${camera.deviceName} (${camera.deviceId})`);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Switch to specified camera
|
|
59
|
+
const switchCamera = async (deviceId: string) => {
|
|
60
|
+
try {
|
|
61
|
+
// Switch device (if camera is already on, will automatically re-capture using new device)
|
|
62
|
+
await setCurrentCamera({ deviceId });
|
|
63
|
+
console.log('Camera switched successfully');
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error('Camera switch failed:', error);
|
|
66
|
+
// On switch failure, will continue using original device
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Monitor current camera changes
|
|
71
|
+
watch(currentCamera, (camera) => {
|
|
72
|
+
if (camera) {
|
|
73
|
+
console.log('Currently using camera:', camera.deviceName);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> **Note:**
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
> When calling [setCurrentCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setCurrentCamera) to switch devices, if the camera is already on, Atomicx will automatically stop capturing from the current device and restart capture using the new device, with seamless video stream switching. If switching fails, it will continue using the original device.
|
|
82
|
+
>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
#### Mobile Camera Switch Example
|
|
86
|
+
|
|
87
|
+
Mobile devices use [switchCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#switchCamera) to switch between front and rear cameras.
|
|
88
|
+
``` typescript
|
|
89
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
90
|
+
const { isFrontCamera, switchCamera } = useDeviceState();
|
|
91
|
+
|
|
92
|
+
// Determine if mobile device
|
|
93
|
+
const isMobile = /Android|webOS|iPhone|iPad|iPod/i.test(navigator.userAgent);
|
|
94
|
+
|
|
95
|
+
// Switch front/rear camera (only supported on mobile)
|
|
96
|
+
const toggleCamera = async () => {
|
|
97
|
+
if (!isMobile) {
|
|
98
|
+
console.warn('Front/rear camera switching is only supported on mobile devices');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Switch to opposite camera
|
|
103
|
+
await switchCamera({ isFrontCamera: !isFrontCamera.value });
|
|
104
|
+
console.log(`Switched to ${isFrontCamera.value ? 'front' : 'rear'} camera`);
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Step 3: Handle Camera Capture Errors
|
|
109
|
+
|
|
110
|
+
When camera capture errors occur, you can get error information through the [cameraLastError](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#cameraLastError) property.
|
|
111
|
+
|
|
112
|
+
> Note:
|
|
113
|
+
>
|
|
114
|
+
|
|
115
|
+
> Common camera errors include `NoSystemPermission` (no system permission) and `OccupiedError` (device occupied). You should display clear error messages to users based on this property.
|
|
116
|
+
>
|
|
117
|
+
|
|
118
|
+
``` typescript
|
|
119
|
+
import { useDeviceState, DeviceError } from 'tuikit-atomicx-vue3/room';
|
|
120
|
+
const { cameraLastError } = useDeviceState();
|
|
121
|
+
|
|
122
|
+
// Monitor camera errors
|
|
123
|
+
watch(cameraLastError, (error) => {
|
|
124
|
+
switch (error) {
|
|
125
|
+
case DeviceError.NoSystemPermission:
|
|
126
|
+
console.error('Camera permission denied, please enable camera permission in system settings');
|
|
127
|
+
break;
|
|
128
|
+
case DeviceError.NoDeviceDetected:
|
|
129
|
+
console.error('No camera device detected');
|
|
130
|
+
break;
|
|
131
|
+
case DeviceError.OccupiedError:
|
|
132
|
+
console.error('Camera is occupied by another application');
|
|
133
|
+
break;
|
|
134
|
+
case DeviceError.NotSupportCapture:
|
|
135
|
+
console.error('Current browser does not support camera capture');
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Implementing Microphone Management
|
|
144
|
+
|
|
145
|
+
You can control local microphone on/off, mute, volume adjustment, and real-time volume display through [useDeviceState](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState), and monitor capture status and errors.
|
|
146
|
+
|
|
147
|
+
### Step 1: Enable/Disable Microphone
|
|
148
|
+
``` typescript
|
|
149
|
+
import { useDeviceState, DeviceStatus } from 'tuikit-atomicx-vue3/room';
|
|
150
|
+
const { microphoneStatus, openLocalMicrophone, closeLocalMicrophone } = useDeviceState();
|
|
151
|
+
const toggleMicrophone = async () => {
|
|
152
|
+
if (microphoneStatus.value === DeviceStatus.On) {
|
|
153
|
+
await closeLocalMicrophone();
|
|
154
|
+
} else {
|
|
155
|
+
await openLocalMicrophone();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 2: Get/Switch Microphone Device
|
|
161
|
+
|
|
162
|
+
#### Desktop Browser Get/Switch Microphone Example
|
|
163
|
+
|
|
164
|
+
You can get all available microphone devices through [microphoneList](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#microphoneList), and use [setCurrentMicrophone](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setCurrentMicrophone) method to switch the currently used microphone.
|
|
165
|
+
``` typescript
|
|
166
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
167
|
+
|
|
168
|
+
const {
|
|
169
|
+
microphoneList,
|
|
170
|
+
currentMicrophone,
|
|
171
|
+
getMicrophoneList,
|
|
172
|
+
setCurrentMicrophone
|
|
173
|
+
} = useDeviceState();
|
|
174
|
+
|
|
175
|
+
// Get microphone list
|
|
176
|
+
await getMicrophoneList();
|
|
177
|
+
|
|
178
|
+
// Iterate and display available microphones
|
|
179
|
+
microphoneList.value.forEach((mic) => {
|
|
180
|
+
console.log(`Microphone: ${mic.deviceName} (${mic.deviceId})`);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Switch to specified microphone
|
|
184
|
+
const switchMicrophone = async (deviceId: string) => {
|
|
185
|
+
await setCurrentMicrophone({ deviceId });
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Monitor current microphone changes
|
|
189
|
+
watch(currentMicrophone, (mic) => {
|
|
190
|
+
if (mic) {
|
|
191
|
+
console.log('Currently using microphone:', mic.deviceName);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Step 3: Set Capture Volume
|
|
197
|
+
|
|
198
|
+
You can use the [setCaptureVolume](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setCaptureVolume) method to adjust the local microphone capture volume.
|
|
199
|
+
``` typescript
|
|
200
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
201
|
+
const { captureVolume, setCaptureVolume } = useDeviceState();
|
|
202
|
+
|
|
203
|
+
// Set capture volume to 50%
|
|
204
|
+
await setCaptureVolume(50);
|
|
205
|
+
|
|
206
|
+
// Monitor capture volume changes
|
|
207
|
+
watch(captureVolume, (volume) => {
|
|
208
|
+
console.log('Current capture volume:', volume);
|
|
209
|
+
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Step 4: Display Real-time Volume
|
|
213
|
+
|
|
214
|
+
The [currentMicVolume](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#currentMicVolume) property updates the local microphone capture volume in real-time, and can be used for dynamic volume bar display.
|
|
215
|
+
``` typescript
|
|
216
|
+
<template>
|
|
217
|
+
<div class="mic-volume">
|
|
218
|
+
<label>Microphone Volume</label>
|
|
219
|
+
<div class="volume-bar-container">
|
|
220
|
+
<div
|
|
221
|
+
class="volume-bar"
|
|
222
|
+
:style="{ width: `${currentMicVolume}%` }"
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
<span>{{ currentMicVolume }}</span>
|
|
226
|
+
</div>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<script setup lang="ts">
|
|
230
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
231
|
+
const { currentMicVolume } = useDeviceState();
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<style scoped>
|
|
235
|
+
.volume-bar-container {
|
|
236
|
+
width: 200px;
|
|
237
|
+
height: 8px;
|
|
238
|
+
background-color: #e0e0e0;
|
|
239
|
+
border-radius: 4px;
|
|
240
|
+
overflow: hidden;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.volume-bar {
|
|
244
|
+
height: 100%;
|
|
245
|
+
background-color: #4caf50;
|
|
246
|
+
transition: width 0.1s ease;
|
|
247
|
+
}
|
|
248
|
+
</style>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Step 5: Handle Microphone Capture Errors
|
|
252
|
+
|
|
253
|
+
When microphone capture errors occur, you can get error information through [microphoneLastError](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#microphoneLastError) data.
|
|
254
|
+
``` typescript
|
|
255
|
+
import { useDeviceState, DeviceError } from 'tuikit-atomicx-vue3/room';
|
|
256
|
+
const { microphoneLastError } = useDeviceState();
|
|
257
|
+
|
|
258
|
+
// Monitor microphone errors
|
|
259
|
+
watch(microphoneLastError, (error) => {
|
|
260
|
+
switch (error) {
|
|
261
|
+
case DeviceError.NoSystemPermission:
|
|
262
|
+
console.error('Microphone permission denied, please enable microphone permission in system settings');
|
|
263
|
+
break;
|
|
264
|
+
case DeviceError.NoDeviceDetected:
|
|
265
|
+
console.error('No microphone device detected');
|
|
266
|
+
break;
|
|
267
|
+
case DeviceError.OccupiedError:
|
|
268
|
+
console.error('Microphone is occupied by another application');
|
|
269
|
+
break;
|
|
270
|
+
case DeviceError.NotSupportCapture:
|
|
271
|
+
console.error('Current browser does not support microphone capture');
|
|
272
|
+
break;
|
|
273
|
+
default:
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Implementing Speaker Management
|
|
280
|
+
|
|
281
|
+
Speaker (playback device) mainly involves switching devices and setting playback volume.
|
|
282
|
+
|
|
283
|
+
### Step 1: Get/Switch Speaker Device
|
|
284
|
+
|
|
285
|
+
You can get all available speaker devices through [speakerList](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#speakerList), and use [setCurrentSpeaker](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setCurrentSpeaker) method to switch the currently used speaker.
|
|
286
|
+
``` typescript
|
|
287
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
288
|
+
const {
|
|
289
|
+
speakerList,
|
|
290
|
+
currentSpeaker,
|
|
291
|
+
getSpeakerList,
|
|
292
|
+
setCurrentSpeaker
|
|
293
|
+
} = useDeviceState();
|
|
294
|
+
|
|
295
|
+
// Get speaker list
|
|
296
|
+
await getSpeakerList();
|
|
297
|
+
|
|
298
|
+
// Iterate and display available speakers
|
|
299
|
+
speakerList.value.forEach((speaker) => {
|
|
300
|
+
console.log(`Speaker: ${speaker.deviceName} (${speaker.deviceId})`);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// Switch to specified speaker
|
|
304
|
+
const switchSpeaker = async (deviceId: string) => {
|
|
305
|
+
await setCurrentSpeaker({ deviceId });
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
// Monitor current speaker changes
|
|
309
|
+
watch(currentSpeaker, (speaker) => {
|
|
310
|
+
if (speaker) {
|
|
311
|
+
console.log('Currently using speaker:', speaker.deviceName);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Step 2: Set Playback Volume
|
|
317
|
+
|
|
318
|
+
You can use the [setOutputVolume](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#setOutputVolume) method to adjust speaker playback volume.
|
|
319
|
+
``` typescript
|
|
320
|
+
import { useDeviceState } from 'tuikit-atomicx-vue3/room';
|
|
321
|
+
const { outputVolume, setOutputVolume } = useDeviceState();
|
|
322
|
+
|
|
323
|
+
// Set playback volume to 60%
|
|
324
|
+
await setOutputVolume(60);
|
|
325
|
+
|
|
326
|
+
// Monitor playback volume changes
|
|
327
|
+
watch(outputVolume, (volume) => {
|
|
328
|
+
console.log('Current playback volume:', volume);
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Implementing Network Quality Monitoring
|
|
333
|
+
|
|
334
|
+
Using the [networkInfo](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#networkInfo) data in [useDeviceState](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState), you can monitor the local user's network quality in real-time.
|
|
335
|
+
|
|
336
|
+
> **Note:**
|
|
337
|
+
>
|
|
338
|
+
|
|
339
|
+
> Valid data can only be obtained in [networkInfo](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#networkInfo) when the local user has joined the room through [joinRoom](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#joinRoom) and turned on the microphone or camera.
|
|
340
|
+
>
|
|
341
|
+
|
|
342
|
+
``` typescript
|
|
343
|
+
<template>
|
|
344
|
+
<div class="network-indicator" @click="showDetails = !showDetails">
|
|
345
|
+
<TUIIcon v-if="networkIcon" :icon="networkIcon" />
|
|
346
|
+
<span class="network-text">{{ networkText }}</span>
|
|
347
|
+
<div v-if="showDetails" class="network-details">
|
|
348
|
+
<div>Latency: {{ networkInfo?.delay }}ms</div>
|
|
349
|
+
<div>Uplink Loss: {{ networkInfo?.upLoss }}%</div>
|
|
350
|
+
<div>Downlink Loss: {{ networkInfo?.downLoss }}%</div>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
</template>
|
|
354
|
+
|
|
355
|
+
<script setup lang="ts">
|
|
356
|
+
import { computed, ref } from 'vue';
|
|
357
|
+
import {
|
|
358
|
+
IconNetworkStability,
|
|
359
|
+
IconNetworkFluctuation,
|
|
360
|
+
IconNetworkLag,
|
|
361
|
+
IconNetworkDisconnected,
|
|
362
|
+
IconArrowStrokeUp,
|
|
363
|
+
} from '@tencentcloud/uikit-base-component-vue3';
|
|
364
|
+
import { useDeviceState, NetworkQuality } from 'tuikit-atomicx-vue3/room';
|
|
365
|
+
|
|
366
|
+
const { networkInfo } = useDeviceState();
|
|
367
|
+
const showDetails = ref(false);
|
|
368
|
+
|
|
369
|
+
// Network quality icon
|
|
370
|
+
const networkIcon = computed(() => {
|
|
371
|
+
if (!networkInfo.value) return '';
|
|
372
|
+
switch (networkInfo.value.quality) {
|
|
373
|
+
case NetworkQuality.Excellent:
|
|
374
|
+
case NetworkQuality.Good:
|
|
375
|
+
return IconNetworkStability;
|
|
376
|
+
case NetworkQuality.Poor:
|
|
377
|
+
return IconNetworkFluctuation;
|
|
378
|
+
case NetworkQuality.Bad:
|
|
379
|
+
case NetworkQuality.VeryBad:
|
|
380
|
+
return IconNetworkLag;
|
|
381
|
+
case NetworkQuality.Down:
|
|
382
|
+
return IconNetworkDisconnected;
|
|
383
|
+
default:
|
|
384
|
+
return '';
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// Network quality text
|
|
389
|
+
const networkText = computed(() => {
|
|
390
|
+
if (!networkInfo.value) return 'Unknown';
|
|
391
|
+
switch (networkInfo.value.quality) {
|
|
392
|
+
case NetworkQuality.Excellent:
|
|
393
|
+
return 'Excellent';
|
|
394
|
+
case NetworkQuality.Good:
|
|
395
|
+
return 'Good';
|
|
396
|
+
case NetworkQuality.Poor:
|
|
397
|
+
return 'Fair';
|
|
398
|
+
case NetworkQuality.Bad:
|
|
399
|
+
return 'Poor';
|
|
400
|
+
case NetworkQuality.VeryBad:
|
|
401
|
+
return 'Very Poor';
|
|
402
|
+
case NetworkQuality.Down:
|
|
403
|
+
return 'Disconnected';
|
|
404
|
+
default:
|
|
405
|
+
return 'Unknown';
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
</script>
|
|
409
|
+
|
|
410
|
+
<style scoped>
|
|
411
|
+
|
|
412
|
+
.network-indicator {
|
|
413
|
+
position: relative;
|
|
414
|
+
display: flex;
|
|
415
|
+
align-items: center;
|
|
416
|
+
gap: 8px;
|
|
417
|
+
padding: 8px 12px;
|
|
418
|
+
border-radius: 4px;
|
|
419
|
+
cursor: pointer;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.network-details {
|
|
423
|
+
position: absolute;
|
|
424
|
+
top: 100%;
|
|
425
|
+
left: 0;
|
|
426
|
+
margin-top: 4px;
|
|
427
|
+
padding: 8px;
|
|
428
|
+
background: white;
|
|
429
|
+
border-radius: 4px;
|
|
430
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
431
|
+
font-size: 12px;
|
|
432
|
+
white-space: nowrap;
|
|
433
|
+
z-index: 2;
|
|
434
|
+
}
|
|
435
|
+
</style>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## API Documentation
|
|
439
|
+
<table>
|
|
440
|
+
<tr>
|
|
441
|
+
<td rowspan="1" colSpan="1" >**State/Component**</td>
|
|
442
|
+
|
|
443
|
+
<td rowspan="1" colSpan="1" >**Feature Description**</td>
|
|
444
|
+
|
|
445
|
+
<td rowspan="1" colSpan="1" >**API Documentation**</td>
|
|
446
|
+
</tr>
|
|
447
|
+
|
|
448
|
+
<tr>
|
|
449
|
+
<td rowspan="1" colSpan="1" >**useDeviceState**</td>
|
|
450
|
+
|
|
451
|
+
<td rowspan="1" colSpan="1" >Contains audio/video device status, audio/video device list and operation interfaces.</td>
|
|
452
|
+
|
|
453
|
+
<td rowspan="1" colSpan="1" >[API Documentation](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#module-DeviceState)</td>
|
|
454
|
+
</tr>
|
|
455
|
+
</table>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
## FAQ
|
|
459
|
+
|
|
460
|
+
### Can users enter an audio/video room if their computer has no microphone or speaker devices?
|
|
461
|
+
|
|
462
|
+
Yes, they can enter the room. Users can still successfully call the `joinRoom` interface to enter an audio/video room even without a microphone, speaker, or camera. However, in this state, users will face the following interaction exceptions.
|
|
463
|
+
|
|
464
|
+
**Feature Limitations:**
|
|
465
|
+
- **Cannot enable media capture:** Since the system cannot drive the relevant hardware, calling [openLocalMicrophone](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#openLocalMicrophone) or [openLocalCamera](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#openLocalCamera) interfaces will trigger asynchronous errors. At this time, the [microphoneLastError](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#microphoneLastError) or [cameraLastError](https://web.sdk.qcloud.com/trtc/live/web/doc/zh/index.html#cameraLastError) property will return `DeviceError.NoDeviceDetected` (no device detected).
|
|
466
|
+
|
|
467
|
+
- **Capture limitations:** Cannot capture and transmit audio (requires microphone) or video (requires camera) through local devices.
|
|
468
|
+
|
|
469
|
+
- **Playback limitations:** Due to lack of speaker devices, users will not be able to hear audio from other participants in the room.
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
**Functions that can still be used:**
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
View-only mode: Users can still watch video streams or screen sharing from remote participants.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
### How to implement device hot-plug detection?
|
|
479
|
+
|
|
480
|
+
Atomicx has built-in device hot-plug detection. When media devices are plugged in or unplugged, the device list and current device data will be automatically updated.
|