@tencentcloud/sdk-mcp 1.3.8 → 1.3.9

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 (70) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/chatuikit/android/integration.md +466 -484
  3. package/resource/doc/chatuikit/android/workflow.md +713 -0
  4. package/resource/doc/livekit/live/flutter/live-integration.md +208 -167
  5. package/resource/doc/livekit/voice/android/voice-audience-list.md +335 -0
  6. package/resource/doc/livekit/voice/android/voice-audio-effect.md +384 -0
  7. package/resource/doc/livekit/voice/android/voice-barrage.md +569 -0
  8. package/resource/doc/livekit/voice/android/voice-co-guest-interaction.md +748 -0
  9. package/resource/doc/livekit/voice/android/voice-gift.md +833 -0
  10. package/resource/doc/livekit/voice/android/voice-host-interaction.md +728 -0
  11. package/resource/doc/livekit/voice/android/voice-integration.md +886 -0
  12. package/resource/doc/livekit/voice/android/voice-room-list.md +493 -0
  13. package/resource/doc/livekit/voice/android/workflow.md +333 -0
  14. package/resource/doc/livekit/voice/flutter/voice-audience-list.md +337 -0
  15. package/resource/doc/livekit/voice/flutter/voice-audio-effect.md +739 -0
  16. package/resource/doc/livekit/voice/flutter/voice-barrage.md +578 -0
  17. package/resource/doc/livekit/voice/flutter/voice-co-guest-interaction.md +673 -0
  18. package/resource/doc/livekit/voice/flutter/voice-gift.md +812 -0
  19. package/resource/doc/livekit/voice/flutter/voice-integration.md +925 -0
  20. package/resource/doc/livekit/voice/flutter/voice-room-list.md +842 -0
  21. package/resource/doc/livekit/voice/flutter/workflow.md +359 -0
  22. package/resource/doc/livekit/voice/ios/voice-audience-list.md +335 -0
  23. package/resource/doc/livekit/voice/ios/voice-audio-effect.md +373 -0
  24. package/resource/doc/livekit/voice/ios/voice-barrage.md +529 -0
  25. package/resource/doc/livekit/voice/ios/voice-co-guest-interaction.md +701 -0
  26. package/resource/doc/livekit/voice/ios/voice-gift.md +785 -0
  27. package/resource/doc/livekit/voice/ios/voice-host-interaction.md +820 -0
  28. package/resource/doc/livekit/voice/ios/voice-integration.md +853 -0
  29. package/resource/doc/livekit/voice/ios/voice-room-list.md +467 -0
  30. package/resource/doc/livekit/voice/ios/workflow.md +358 -0
  31. package/resource/doc/livekit/voice/uni-app/voice-audience-list.md +264 -0
  32. package/resource/doc/livekit/voice/uni-app/voice-audio-effect.md +332 -0
  33. package/resource/doc/livekit/voice/uni-app/voice-barrage.md +482 -0
  34. package/resource/doc/livekit/voice/uni-app/voice-co-guest-interaction.md +944 -0
  35. package/resource/doc/livekit/voice/uni-app/voice-gift.md +716 -0
  36. package/resource/doc/livekit/voice/uni-app/voice-integration.md +613 -0
  37. package/resource/doc/livekit/voice/uni-app/voice-room-list.md +562 -0
  38. package/resource/doc/livekit/voice/uni-app/workflow.md +369 -0
  39. package/resource/doc/roomkit/vue/integration.md +119 -224
  40. package/resource/doc/roomkit/vue/workflow.md +472 -226
  41. package/resource/doc/tuicallkit/android/integration.md +675 -90
  42. package/resource/doc/tuicallkit/android/workflow.md +432 -0
  43. package/tools/common/present-scenario-choice.js +16 -0
  44. package/tools/common/present-scenario-choice.js.map +1 -0
  45. package/tools/definitions/get_native_call_uikit_integration_def.js +18 -2
  46. package/tools/definitions/get_native_call_uikit_integration_def.js.map +1 -1
  47. package/tools/definitions/get_native_chat_uikit_integration_def.js +29 -7
  48. package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
  49. package/tools/definitions/get_native_live_uikit_integration_def.js +65 -40
  50. package/tools/definitions/get_native_live_uikit_integration_def.js.map +1 -1
  51. package/tools/definitions/get_native_live_uikit_interaction_def.js +42 -94
  52. package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -1
  53. package/tools/definitions/get_web_room_feature_detail_def.js +29 -32
  54. package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -1
  55. package/tools/definitions/get_web_room_uikit_integration_def.js +25 -9
  56. package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -1
  57. package/tools/definitions/present_scenario_choice_def.js +53 -0
  58. package/tools/definitions/present_scenario_choice_def.js.map +1 -0
  59. package/tools/definitions/record_prompt_def.js +6 -1
  60. package/tools/definitions/record_prompt_def.js.map +1 -1
  61. package/tools/definitions/record_result_def.js +20 -4
  62. package/tools/definitions/record_result_def.js.map +1 -1
  63. package/tools/index.js +2 -0
  64. package/tools/index.js.map +1 -1
  65. package/tools/live/get-native-live-uikit-integration.js +110 -34
  66. package/tools/live/get-native-live-uikit-integration.js.map +1 -1
  67. package/tools/live/get_native_live_uikit_interaction.js +128 -35
  68. package/tools/live/get_native_live_uikit_interaction.js.map +1 -1
  69. package/utils/report-cls-client.js +1 -1
  70. package/utils/report-es-client.js +1 -1
@@ -0,0 +1,562 @@
1
+ `LiveListState` 是 `AtomicXCore` 中负责管理直播房间列表、创建、加入以及维护房间状态的核心模块。通过`LiveListState`,您可以为您的应用构建完整的直播生命周期管理。
2
+
3
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100028028022/b2f1b93ebb0411f0b0cf525400e889b2.png)
4
+
5
+
6
+ ## 核心功能
7
+ - **直播列表拉取**:获取当前所有公开的直播间列表,支持分页加载。
8
+
9
+ - **直播生命周期管理**:提供从创建、开播、加入、离开到结束直播的全套流程接口。
10
+
11
+ - **直播信息更新**:主播可以随时更新直播间的公开信息,例如封面、公告等。
12
+
13
+ - **实时事件监听**:监听直播结束、用户被踢出等关键事件。
14
+
15
+ - **自定义业务数据**:强大的自定义元数据(`MetaData`)能力,允许您在房间内存储和同步任何业务相关的信息,例如直播状态、音乐信息、自定义角色等 。
16
+
17
+
18
+ ## 实现步骤
19
+
20
+ ### 步骤1:组件集成
21
+
22
+ 请参考 [快速接入](https://write.woa.com/document/191656297444069376) 集成 **AtomicXCore**,并完成搭建基础语聊房的功能实现。
23
+
24
+ ### 步骤2:实现观众从直播列表进入直播间
25
+
26
+ 创建一个展示直播列表的页面。当用户点击某个卡片时,获取该直播间的 `liveID`,并跳转到观众观看页面。
27
+ ``` typescript
28
+ <template>
29
+ <view class="live-list">
30
+ <!-- 直播列表 -->
31
+ <list class="list" :show-scrollbar="false">
32
+ <!-- 行循环 -->
33
+ <cell v-for="(row, idx) in groupedList" :key="`row-${idx}`">
34
+ <view class="row">
35
+ <!-- 卡片循环 -->
36
+ <view
37
+ v-for="live in row"
38
+ :key="live.liveID"
39
+ class="card"
40
+ @tap="handleJoinLive(live)"
41
+ >
42
+ <image :src="live.coverURL || defaultCover" class="cover" />
43
+ <view class="info">
44
+ <text class="title">{{ live.liveName }}</text>
45
+ <text class="owner">{{ live.liveOwner?.userName }}</text>
46
+ <text class="count">{{ live.totalViewerCount }}人看过</text>
47
+ </view>
48
+ </view>
49
+ </view>
50
+ </cell>
51
+ </list>
52
+ </view>
53
+ </template>
54
+
55
+ <script setup lang="ts">
56
+ import { computed, onMounted } from 'vue';
57
+ import { useLiveListState } from "@/uni_modules/tuikit-atomic-x/state/LiveListState";
58
+
59
+ // 状态管理
60
+ const { liveList, liveListCursor, fetchLiveList } = useLiveListState();
61
+
62
+ // 计算属性:分组列表(每行2个)您可以在这里进行每行展示个数的设置。
63
+ const groupedList = computed(() => {
64
+ const list = liveList.value || [];
65
+ const groups = [];
66
+ for (let i = 0; i < list.length; i += 2) {
67
+ groups.push(list.slice(i, i + 2));
68
+ }
69
+ return groups;
70
+ });
71
+
72
+ // 初始化
73
+ onMounted(() => {
74
+ fetchLiveList({ cursor: "", count: 20 });
75
+ });
76
+
77
+ // 加入直播
78
+ const handleJoinLive = (live: any) => {
79
+ uni.redirectTo({ url: `/pages/audience/index?liveID=${live.liveID}` }); // 跳转至您的目标页面
80
+ };
81
+
82
+ </script>
83
+
84
+ <style scoped>
85
+ .live-list {
86
+ flex: 1;
87
+ background: #fff;
88
+ }
89
+
90
+ .list {
91
+ width: 100%;
92
+ }
93
+
94
+ .row {
95
+ flex-direction: row;
96
+ padding: 0 32rpx 16rpx;
97
+ justify-content: space-between;
98
+ }
99
+
100
+ .card {
101
+ width: 48%;
102
+ height: 320rpx;
103
+ background: #f5f5f5;
104
+ border-radius: 12rpx;
105
+ overflow: hidden;
106
+ }
107
+
108
+ .cover {
109
+ width: 100%;
110
+ height: 220rpx;
111
+ }
112
+
113
+ .info {
114
+ flex: 1;
115
+ padding: 12rpx;
116
+ flex-direction: column;
117
+ }
118
+
119
+ .title {
120
+ font-size: 26rpx;
121
+ font-weight: 600;
122
+ color: #000;
123
+ lines: 1;
124
+ text-overflow: ellipsis;
125
+ overflow: hidden;
126
+ }
127
+
128
+ .owner {
129
+ font-size: 22rpx;
130
+ color: #666;
131
+ margin-top: 4rpx;
132
+ lines: 1;
133
+ text-overflow: ellipsis;
134
+ overflow: hidden;
135
+ }
136
+
137
+ .count {
138
+ font-size: 20rpx;
139
+ color: #999;
140
+ margin-top: 4rpx;
141
+ lines: 1;
142
+ text-overflow: ellipsis;
143
+ overflow: hidden;
144
+ }
145
+ </style>
146
+ ```
147
+
148
+ **LiveInfo 参数说明**
149
+ <table>
150
+ <tr>
151
+ <td rowspan="1" colSpan="1" >**参数名**</td>
152
+
153
+ <td rowspan="1" colSpan="1" >**类型**</td>
154
+
155
+ <td rowspan="1" colSpan="1" >**描述**</td>
156
+ </tr>
157
+
158
+ <tr>
159
+ <td rowspan="1" colSpan="1" >`liveID`</td>
160
+
161
+ <td rowspan="1" colSpan="1" >`string`</td>
162
+
163
+ <td rowspan="1" colSpan="1" >直播间的唯一标识符</td>
164
+ </tr>
165
+
166
+ <tr>
167
+ <td rowspan="1" colSpan="1" >`liveName`</td>
168
+
169
+ <td rowspan="1" colSpan="1" >`string`</td>
170
+
171
+ <td rowspan="1" colSpan="1" >直播间的标题</td>
172
+ </tr>
173
+
174
+ <tr>
175
+ <td rowspan="1" colSpan="1" >`coverURL`</td>
176
+
177
+ <td rowspan="1" colSpan="1" >`string`</td>
178
+
179
+ <td rowspan="1" colSpan="1" >直播间的封面图片地址</td>
180
+ </tr>
181
+
182
+ <tr>
183
+ <td rowspan="1" colSpan="1" >`liveOwner`</td>
184
+
185
+ <td rowspan="1" colSpan="1" >[LiveUserInfo](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/liveuserinfo)</td>
186
+
187
+ <td rowspan="1" colSpan="1" >房主的个人信息</td>
188
+ </tr>
189
+
190
+ <tr>
191
+ <td rowspan="1" colSpan="1" >`totalViewerCount`</td>
192
+
193
+ <td rowspan="1" colSpan="1" >`number`</td>
194
+
195
+ <td rowspan="1" colSpan="1" >直播间的总观看人数</td>
196
+ </tr>
197
+
198
+ <tr>
199
+ <td rowspan="1" colSpan="1" >`categoryList`</td>
200
+
201
+ <td rowspan="1" colSpan="1" >`[number]`</td>
202
+
203
+ <td rowspan="1" colSpan="1" >直播间的分类标签列表</td>
204
+ </tr>
205
+
206
+ <tr>
207
+ <td rowspan="1" colSpan="1" >`notice`</td>
208
+
209
+ <td rowspan="1" colSpan="1" >`string`</td>
210
+
211
+ <td rowspan="1" colSpan="1" >直播间的公告信息</td>
212
+ </tr>
213
+
214
+ <tr>
215
+ <td rowspan="1" colSpan="1" >`metaData`</td>
216
+
217
+ <td rowspan="1" colSpan="1" >`[string: string]`</td>
218
+
219
+ <td rowspan="1" colSpan="1" >开发者自定义的元数据,用于实现复杂的业务场景</td>
220
+ </tr>
221
+ </table>
222
+
223
+
224
+ ## 功能进阶
225
+
226
+ ### 场景一:实现直播列表的分类展示
227
+
228
+ 在 App 的直播广场页,顶部设有“热门”、“音乐”、“游戏”等分类标签。用户点击不同的标签后,下方的直播列表会动态筛选,只展示对应分类的直播间,从而帮助用户快速发现感兴趣的内容。
229
+
230
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100028028022/faebc0fcbb0411f0b4c35254001c06ec.png)
231
+
232
+
233
+ #### 实现方式
234
+
235
+ 核心是利用 `LiveInfo` 模型中的 `categoryList` 属性。当主播开播设置分类后,`fetchLiveList` 返回的 `LiveInfo` 对象中就会包含这些分类信息。您的 App 在获取到完整的直播列表后,只需在客户端根据用户选择的分类,对这个列表进行一次简单的筛选,然后刷新 UI 即可。
236
+
237
+ #### 代码示例
238
+
239
+ 以下示例展示了如何在直播列表页中增加根据一个`categoryList`来处理数据和筛选逻辑的 `UI`。
240
+ ``` typescript
241
+ <template>
242
+ <view class="live-list">
243
+ <!-- 分类标签栏 -->
244
+ <view class="category-tabs">
245
+ <view
246
+ v-for="cat in categories"
247
+ :key="cat.id"
248
+ class="tab"
249
+ :class="{ active: selectedCategory === cat.id }"
250
+ @tap="selectedCategory = cat.id"
251
+ >
252
+ {{ cat.name }}
253
+ </view>
254
+ </view>
255
+
256
+ <!-- 直播列表 -->
257
+ <list class="list" @loadmore="loadMore" :show-scrollbar="false">
258
+ <!-- 行循环 -->
259
+ <cell v-for="(row, idx) in groupedList" :key="`row-${idx}`">
260
+ <view class="row">
261
+ <!-- 卡片循环 -->
262
+ <view
263
+ v-for="live in row"
264
+ :key="live.liveID"
265
+ class="card"
266
+ @tap="handleJoinLive(live)"
267
+ >
268
+ <image :src="live.coverURL" class="cover" />
269
+
270
+ <!-- 分类标签 -->
271
+ <view v-if="live.liveInfo?.categoryList?.length" class="category-badge">
272
+ <text class="badge-text">{{ getCategoryName(live.liveInfo.categoryList[0]) }}</text>
273
+ </view>
274
+
275
+ <view class="info">
276
+ <text class="title">{{ live.liveName }}</text>
277
+ <text class="owner">{{ live.liveOwner?.userName }}</text>
278
+ <text class="count">{{ live.totalViewerCount }}人看过</text>
279
+ </view>
280
+ </view>
281
+ </view>
282
+ </cell>
283
+ </list>
284
+ </view>
285
+ </template>
286
+
287
+ <script setup lang="ts">
288
+ import { computed, onMounted, ref } from 'vue';
289
+ import { useLiveListState } from "@/uni_modules/tuikit-atomic-x/state/LiveListState";
290
+
291
+ // 状态管理
292
+ const { liveList, liveListCursor, fetchLiveList } = useLiveListState();
293
+
294
+ // 本地状态
295
+ const selectedCategory = ref(0); // 0 代表全部
296
+
297
+ // 分类列表
298
+ const categories = [
299
+ { id: 0, name: '全部' },
300
+ { id: 1, name: '游戏' },
301
+ { id: 2, name: '音乐' },
302
+ { id: 3, name: '聊天' },
303
+ { id: 4, name: '体育' },
304
+ { id: 5, name: '娱乐' },
305
+ ];
306
+
307
+ // 分类名称映射
308
+ const categoryMap: Record<number, string> = {
309
+ 1: '游戏',
310
+ 2: '音乐',
311
+ 3: '聊天',
312
+ 4: '体育',
313
+ 5: '娱乐',
314
+ };
315
+
316
+ // 获取分类名称
317
+ const getCategoryName = (categoryId: number) => {
318
+ return categoryMap[categoryId] || '其他';
319
+ };
320
+
321
+ // 计算属性:过滤分类后的列表
322
+ const filteredList = computed(() => {
323
+ const list = liveList.value || [];
324
+
325
+ // 如果选择"全部",直接返回全部列表
326
+ if (selectedCategory.value === 0) {
327
+ return list;
328
+ }
329
+
330
+ // 根据选中的分类过滤
331
+ return list.filter(live => {
332
+ const categoryList = live.liveInfo?.categoryList || [];
333
+ return categoryList.includes(selectedCategory.value);
334
+ });
335
+ });
336
+
337
+ // 计算属性:分组列表(每行2个)
338
+ const groupedList = computed(() => {
339
+ const list = filteredList.value;
340
+ const groups = [];
341
+ for (let i = 0; i < list.length; i += 2) {
342
+ groups.push(list.slice(i, i + 2));
343
+ }
344
+ return groups;
345
+ });
346
+
347
+ // 初始化
348
+ onMounted(() => {
349
+ fetchLiveList({ cursor: "", count: 20 });
350
+ });
351
+
352
+ // 加入直播
353
+ const handleJoinLive = (live: any) => {
354
+ uni.redirectTo({ url: `/pages/audience/index?liveID=${live.liveID}` }); // 跳转至您的目标页面
355
+ };
356
+ </script>
357
+
358
+ <style scoped>
359
+ .live-list {
360
+ flex: 1;
361
+ background: #fff;
362
+ }
363
+
364
+ /* 分类标签栏 */
365
+ .category-tabs {
366
+ flex-direction: row;
367
+ padding: 16rpx 32rpx;
368
+ background: #f9f9f9;
369
+ border-bottom: 1rpx solid #e8e8e8;
370
+ overflow-x: auto;
371
+ }
372
+
373
+ .tab {
374
+ padding: 8rpx 20rpx;
375
+ margin-right: 12rpx;
376
+ background: #fff;
377
+ border: 1rpx solid #e0e0e0;
378
+ border-radius: 20rpx;
379
+ font-size: 24rpx;
380
+ color: #666;
381
+ white-space: nowrap;
382
+ }
383
+
384
+ .tab.active {
385
+ background: #0468FC;
386
+ border-color: #0468FC;
387
+ color: #fff;
388
+ }
389
+
390
+ .list {
391
+ width: 100%;
392
+ }
393
+
394
+ .row {
395
+ flex-direction: row;
396
+ padding: 0 32rpx 16rpx;
397
+ justify-content: space-between;
398
+ }
399
+
400
+ .card {
401
+ width: 48%;
402
+ height: 320rpx;
403
+ background: #f5f5f5;
404
+ border-radius: 12rpx;
405
+ overflow: hidden;
406
+ position: relative;
407
+ }
408
+
409
+ .cover {
410
+ width: 100%;
411
+ height: 220rpx;
412
+ }
413
+
414
+ /* 分类徽章 */
415
+ .category-badge {
416
+ position: absolute;
417
+ top: 8rpx;
418
+ left: 8rpx;
419
+ background: rgba(4, 104, 252, 0.9);
420
+ border-radius: 4rpx;
421
+ padding: 4rpx 8rpx;
422
+ }
423
+
424
+ .badge-text {
425
+ font-size: 18rpx;
426
+ color: #fff;
427
+ font-weight: 600;
428
+ }
429
+
430
+ .info {
431
+ flex: 1;
432
+ padding: 12rpx;
433
+ flex-direction: column;
434
+ }
435
+
436
+ .title {
437
+ font-size: 26rpx;
438
+ font-weight: 600;
439
+ color: #000;
440
+ lines: 1;
441
+ text-overflow: ellipsis;
442
+ overflow: hidden;
443
+ }
444
+
445
+ .owner {
446
+ font-size: 22rpx;
447
+ color: #666;
448
+ margin-top: 4rpx;
449
+ lines: 1;
450
+ text-overflow: ellipsis;
451
+ overflow: hidden;
452
+ }
453
+
454
+ .count {
455
+ font-size: 20rpx;
456
+ color: #999;
457
+ margin-top: 4rpx;
458
+ lines: 1;
459
+ text-overflow: ellipsis;
460
+ overflow: hidden;
461
+ }
462
+ </style>
463
+ ```
464
+
465
+ ### 场景二:实现语聊房内的自定义状态同步
466
+
467
+ 在语聊房中,主播可能需要向所有观众同步一些自定义信息,例如“当前房间话题”、“背景音乐信息”等。`LiveListState` 的 `MetaData` 功能可以实现这一点。
468
+
469
+ #### 实现方式
470
+ 1. 主播端将自定义信息(建议使用 JSON 格式)通过 `updateLiveMetaData` 接口设置到一个或多个 key 中。`AtomicXCore` 会将这个变更实时同步给所有观众。
471
+
472
+ 2. 观众端只需监听`currentLive 中 metaData` 的变化,一旦发现关心的 key 更新,就解析其 value 并刷新业务状态。
473
+
474
+
475
+ #### 代码示例
476
+ ``` typescript
477
+ import { useLiveListState } from "@/uni_modules/tuikit-atomic-x/state/LiveListState";
478
+
479
+ // 状态管理
480
+ const { updateLiveMetaData, currentLive } = useLiveListState();
481
+ // 1. 定义一个背景音乐模型
482
+ const musicModel = ref({ musicId: '', musicName: '', })
483
+
484
+ // 2. 主播端:在您的主播业务逻辑中,添加推送背景音乐的方法
485
+ const updateBackgroundMusic
486
+ = () => {
487
+ updateLiveMetaData({
488
+ metaData: JSON.stringify(["music_info": musicModel.value]),
489
+ success: () => {
490
+ console.log('背景音乐 ${musicModel.value.musicName} 推送成功')
491
+ },
492
+ fail: (error) => {
493
+ console.log('背景音乐推送失败', error)
494
+ }
495
+ })
496
+ }
497
+
498
+ // 3. 观众端:在观众端监听 currentLive
499
+ watch( currentLive, (newVal, oldVal) => {
500
+ const newMusic = JSON.parse(newVal).metaData
501
+ // 在此播放音乐
502
+ })
503
+ ```
504
+
505
+ ## API 文档
506
+
507
+ 关于 [LiveListState](https://liteav.sdk.qcloud.com/doc/product/tuikit/atomic-x/uni-app/zh/v1.0/api/index.html#module-LiveListState) 及其相关类的所有公开接口、属性和方法的详细信息,请参阅随 [AtomicXCore](https://write.woa.com/document/192223419814899712) 框架的官方 API 文档。本文档使用到的相关 Store 如下:
508
+ <table>
509
+ <tr>
510
+ <td rowspan="1" colSpan="1" >**State**</td>
511
+
512
+ <td rowspan="1" colSpan="1" >**功能描述**</td>
513
+
514
+ <td rowspan="1" colSpan="1" >**API 文档**</td>
515
+ </tr>
516
+
517
+ <tr>
518
+ <td rowspan="1" colSpan="1" >LiveListState</td>
519
+
520
+ <td rowspan="1" colSpan="1" >直播间全生命周期管理:创建 / 加入 / 离开 / 销毁房间,查询房间列表,修改直播信息(名称、公告等),监听直播状态(例如被踢出、结束)。</td>
521
+
522
+ <td rowspan="1" colSpan="1" >[API 文档](https://liteav.sdk.qcloud.com/doc/product/tuikit/atomic-x/uni-app/zh/v1.0/api/index.html#module-LiveListState)</td>
523
+ </tr>
524
+ </table>
525
+
526
+
527
+ ## 常见问题
528
+
529
+ ### 语聊房的列表和视频直播的列表数据是同一份吗?
530
+
531
+ 它们的数据是同一份,您不需要分开拉取。`LiveListState` 是一个全局单例,它负责统一管理应用中所有“直播”房间的生命周期,无论是视频直播还是语聊房。
532
+
533
+ ### **直播列表中如何区分语聊房和视频直播**
534
+
535
+ `LiveListState` 本身不区分房间的业务类型。您需要在获取列表后,在客户端的应用层(业务逻辑或 UI 层)进行筛选和分类。
536
+
537
+ 我们推荐采用以下方式进行区分:
538
+
539
+ **为 **`liveID`** 添加业务前缀。**这是一种可选的、纯粹的应用层约定,用于辅助您在客户端快速筛选。
540
+ - **步骤1:创建房间时添加前缀 **在您生成 liveID 并调用 createLive 时,为不同业务类型的 liveID 赋予不同的前缀。例如:视频直播的 ID 以 “Live_” 开头 (例如: Live_12345),语聊房的 ID 以 “voice_” 开头 (例如: voice_67890)。
541
+
542
+ - **步骤2:获取列表时检查前缀 **客户端在拉取到列表后,通过检查 liveID 字符串的前缀来进行区分。
543
+
544
+
545
+ ### 使用 `updateLiveMetaData` 时有哪些需要注意的限制和规则?
546
+
547
+ 为了保证系统的稳定和高效,`metaData` 的使用遵循以下规则:
548
+ - **权限**: 只有房主和管理员可以调用 `updateLiveMetaData`。普通观众没有权限。
549
+
550
+ - **数量与大小限制**:
551
+
552
+ - 单个房间最多支持 **10** 个 key。
553
+
554
+ - 每个 key 的长度不超过 **50 字节**,每个 value 的长度不超过 **2KB**。
555
+
556
+ - 单个房间所有 value 的总大小不超过 **16KB**。
557
+
558
+ - **冲突解决**: `metaData` 的更新机制是“后来者覆盖”。如果多个管理员在短时间内修改同一个 key,最后一次的修改会生效。建议在业务设计上避免多人同时修改同一个关键信息。
559
+
560
+
561
+
562
+