@tencent-rtc/mcp 1.3.2 → 1.3.3

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 (50) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/livekit/live/android/live-audience-list.md +334 -0
  3. package/resource/doc/livekit/live/android/live-audio-effect.md +380 -0
  4. package/resource/doc/livekit/live/android/live-barrage.md +565 -0
  5. package/resource/doc/livekit/live/android/live-base-beauty.md +275 -0
  6. package/resource/doc/livekit/live/android/live-co-guest-interaction.md +629 -0
  7. package/resource/doc/livekit/live/android/live-gift.md +822 -0
  8. package/resource/doc/livekit/live/android/live-host-interaction.md +888 -0
  9. package/resource/doc/livekit/live/android/live-integration.md +972 -0
  10. package/resource/doc/livekit/live/android/live-live-list.md +575 -0
  11. package/resource/doc/livekit/live/android/workflow.md +189 -0
  12. package/tools/common/record-prompt.js +2 -2
  13. package/tools/common/record-prompt.js.map +1 -1
  14. package/tools/definitions/get_native_live_extra_features_def.js +87 -0
  15. package/tools/definitions/get_native_live_extra_features_def.js.map +1 -0
  16. package/tools/definitions/get_native_live_interaction_def.js +74 -0
  17. package/tools/definitions/get_native_live_interaction_def.js.map +1 -0
  18. package/tools/definitions/get_native_live_uikit_integration_def.js +49 -0
  19. package/tools/definitions/get_native_live_uikit_integration_def.js.map +1 -0
  20. package/tools/definitions/record_prompt_def.js +1 -1
  21. package/tools/definitions/record_prompt_def.js.map +1 -1
  22. package/tools/index.js +6 -0
  23. package/tools/index.js.map +1 -1
  24. package/tools/live/get-native-live-uikit-integration.js +101 -0
  25. package/tools/live/get-native-live-uikit-integration.js.map +1 -0
  26. package/tools/live/get-web-live-component-detail.js +1 -1
  27. package/tools/live/get-web-live-component-detail.js.map +1 -1
  28. package/tools/live/get-web-live-state-detail.js +1 -1
  29. package/tools/live/get-web-live-state-detail.js.map +1 -1
  30. package/tools/live/get-web-live-uikit-integration.js +6 -6
  31. package/tools/live/get-web-live-uikit-integration.js.map +1 -1
  32. package/tools/live/get_native_live_extra_features.js +105 -0
  33. package/tools/live/get_native_live_extra_features.js.map +1 -0
  34. package/tools/live/get_native_live_interaction.js +101 -0
  35. package/tools/live/get_native_live_interaction.js.map +1 -0
  36. package/utils/report-cls-client.js +1 -1
  37. package/utils/report-es-client.js +1 -1
  38. /package/resource/doc/livekit/{vue → live/vue}/components/barrage.md +0 -0
  39. /package/resource/doc/livekit/{vue → live/vue}/components/co-guest-panel.md +0 -0
  40. /package/resource/doc/livekit/{vue → live/vue}/components/live-audience-list.md +0 -0
  41. /package/resource/doc/livekit/{vue → live/vue}/components/live-scene-panel.md +0 -0
  42. /package/resource/doc/livekit/{vue → live/vue}/components/live-view.md +0 -0
  43. /package/resource/doc/livekit/{vue → live/vue}/components/stream-mixer.md +0 -0
  44. /package/resource/doc/livekit/{vue → live/vue}/faq.md +0 -0
  45. /package/resource/doc/livekit/{vue → live/vue}/live-list-integration.md +0 -0
  46. /package/resource/doc/livekit/{vue → live/vue}/live-player-desk-integration.md +0 -0
  47. /package/resource/doc/livekit/{vue → live/vue}/live-player-h5-integration.md +0 -0
  48. /package/resource/doc/livekit/{vue → live/vue}/live-pusher-integration.md +0 -0
  49. /package/resource/doc/livekit/{vue → live/vue}/states/live-state.md +0 -0
  50. /package/resource/doc/livekit/{vue → live/vue}/workflow.md +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-rtc/mcp",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Tencent Cloud MCP Server for SDK",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,334 @@
1
+ `LiveAudienceStore` is a module in `AtomicXCore` designed for managing audience information in live streaming rooms. With `LiveAudienceStore`, you can implement a comprehensive audience list and management system for your live streaming application.
2
+
3
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/125802a4c6b511f09e745254007c27c5.png)
4
+
5
+
6
+ ## Core Features
7
+ - **Real-Time Audience List**: Retrieve and display all audience information currently present in the live room.
8
+
9
+ - **Audience Count Statistics**: Access the accurate, real-time total number of viewers in the live room.
10
+
11
+ - **Audience Activity Monitoring**: Subscribe to events to instantly detect when viewers join or leave.
12
+
13
+ - **Administrator Privileges**: The host can promote regular viewers to administrators or revoke their admin status.
14
+
15
+ - **Room Management**: The host or administrator can remove (kick out) any regular viewer from the live room.
16
+
17
+
18
+ ## Core Concepts
19
+ <table>
20
+ <tr>
21
+ <td rowspan="1" colSpan="1" >**Core Concept**</td>
22
+
23
+ <td rowspan="1" colSpan="1" >**Type**</td>
24
+
25
+ <td rowspan="1" colSpan="1" >**Core Responsibilities & Description**</td>
26
+ </tr>
27
+
28
+ <tr>
29
+ <td rowspan="1" colSpan="1" >`LiveUserInfo`</td>
30
+
31
+ <td rowspan="1" colSpan="1" >data class</td>
32
+
33
+ <td rowspan="1" colSpan="1" >Represents the basic information model of an audience member (user). It contains the user's unique identifier (`userID`), nickname (`userName`), and avatar URL (`avatarURL`).</td>
34
+ </tr>
35
+
36
+ <tr>
37
+ <td rowspan="1" colSpan="1" >`LiveAudienceState`</td>
38
+
39
+ <td rowspan="1" colSpan="1" >data class</td>
40
+
41
+ <td rowspan="1" colSpan="1" >Represents the current state of the audience module. Its core property `audienceList` is a StateFlow that stores the real-time state of the audience list; `audienceCount` represents the real-time state of the current total number of viewers.</td>
42
+ </tr>
43
+
44
+ <tr>
45
+ <td rowspan="1" colSpan="1" >`LiveAudienceListener`</td>
46
+
47
+ <td rowspan="1" colSpan="1" >abstract class</td>
48
+
49
+ <td rowspan="1" colSpan="1" >Represents real-time audience activity events. It includes `onAudienceJoined` (audience joins) and `onAudienceLeft` (audience leaves), used for incremental updates to the audience list.</td>
50
+ </tr>
51
+
52
+ <tr>
53
+ <td rowspan="1" colSpan="1" >`LiveAudienceStore`</td>
54
+
55
+ <td rowspan="1" colSpan="1" >abstract class</td>
56
+
57
+ <td rowspan="1" colSpan="1" >This is the core management class for interacting with audience list functionality. Through it, you can obtain audience list snapshots, perform management operations, and subscribe to its `LiveAudienceListener` for real-time updates.</td>
58
+ </tr>
59
+ </table>
60
+
61
+
62
+ ## Implementation Guide
63
+
64
+ ### Step 1: Component Integration
65
+ - **Video Live Streaming**: Please refer to [Quick Start](https://write.woa.com/document/194571606056804352) to integrate AtomicXCore
66
+
67
+ - **Voice Chat Room**: Please refer to [Quick Start](https://write.woa.com/document/194571595678187521) to integrate AtomicXCore.
68
+
69
+
70
+ ### Step 2: Initialize and Retrieve the Audience List
71
+
72
+ Obtain a `LiveAudienceStore` instance bound to the current live room's `liveId`, and fetch the current audience list for the initial display.
73
+ ``` kotlin
74
+ import kotlinx.coroutines.*
75
+ import kotlinx.coroutines.flow.*
76
+ import io.trtc.tuikit.atomicxcore.api.CompletionHandler
77
+ import io.trtc.tuikit.atomicxcore.api.live.LiveAudienceStore
78
+ import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
79
+
80
+ class AudienceManager(
81
+ private val liveId: String
82
+ ) {
83
+ private val audienceStore: LiveAudienceStore = LiveAudienceStore.create(liveId)
84
+ private val scope = CoroutineScope(Dispatchers.Main)
85
+
86
+ // Expose the [full] audience list state flow for UI layer subscription
87
+ private val _audienceList = MutableStateFlow<List<LiveUserInfo>>(emptyList())
88
+ val audienceList: StateFlow<List<LiveUserInfo>> = _audienceList.asStateFlow()
89
+
90
+ // Expose the audience count state flow
91
+ private val _audienceCount = MutableStateFlow(0)
92
+ val audienceCount: StateFlow<Int> = _audienceCount.asStateFlow()
93
+
94
+ init {
95
+ // 1. Subscribe to state and events, see next section for implementation
96
+ subscribeToAudienceState()
97
+ subscribeToAudienceEvents()
98
+
99
+ // 2. Actively fetch initial data for the first screen
100
+ fetchInitialAudienceList()
101
+ }
102
+
103
+ /// Actively fetch a snapshot of the audience list once
104
+ private fun fetchInitialAudienceList() {
105
+ audienceStore.fetchAudienceList(object : CompletionHandler {
106
+ override fun onSuccess() {
107
+ println("Successfully fetched the initial audience list")
108
+ // After success, the data will be automatically updated via the state subscription channel below
109
+ }
110
+
111
+ override fun onFailure(code: Int, desc: String) {
112
+ println("Failed to fetch the initial audience list: $desc")
113
+ }
114
+ })
115
+ }
116
+
117
+ // ... subsequent code
118
+ }
119
+ ```
120
+
121
+ ### Step 3: Listen to Audience List State and Real-Time Activity
122
+
123
+ Subscribe to the `liveAudienceState` of `audienceStore` and add a `LiveAudienceListener` to receive full list snapshots and real-time audience join/leave events. Use these updates to drive UI changes.
124
+ ``` kotlin
125
+ class AudienceManager {
126
+ /// Subscribe to state for audience count and list snapshots
127
+ private fun subscribeToAudienceState() {
128
+ scope.launch {
129
+ // audienceList is a full snapshot
130
+ audienceStore.liveAudienceState.audienceList.collect { audienceList ->
131
+ _audienceList.value = audienceList
132
+ }
133
+ }
134
+
135
+ scope.launch {
136
+ // audienceCount is the real-time total
137
+ audienceStore.liveAudienceState.audienceCount.collect { count ->
138
+ _audienceCount.value = count
139
+ }
140
+ }
141
+ }
142
+
143
+ /// Subscribe to events to handle real-time audience join/leave
144
+ private fun subscribeToAudienceEvents() {
145
+ audienceStore.addLiveAudienceListener(object : LiveAudienceListener() {
146
+ override fun onAudienceJoined(newAudience: LiveUserInfo) {
147
+ println("Audience ${newAudience.userName} joined the live room")
148
+ // Incremental update: add the new audience member to the end of the current list
149
+ val currentList = _audienceList.value.toMutableList()
150
+ if (!currentList.any { it.userID == newAudience.userID }) {
151
+ currentList.add(newAudience)
152
+ _audienceList.value = currentList
153
+ }
154
+ }
155
+
156
+ override fun onAudienceLeft(departedAudience: LiveUserInfo) {
157
+ println("Audience ${departedAudience.userName} left the live room")
158
+ // Incremental update: remove the departed audience member from the current list
159
+ val currentList = _audienceList.value.toMutableList()
160
+ currentList.removeAll { it.userID == departedAudience.userID }
161
+ _audienceList.value = currentList
162
+ }
163
+ })
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### Step 4: Manage Audience (Kick and Set Administrator)
169
+
170
+ As a host or administrator, you can manage viewers in the live room.
171
+
172
+ #### 4.1 Kick a Viewer Out of the Live Room
173
+
174
+ Call the `kickUserOutOfRoom` method to remove a specified user from the live room.
175
+ ``` kotlin
176
+ class AudienceManager {
177
+ fun kick(userId: String) {
178
+ audienceStore.kickUserOutOfRoom(userId, object : CompletionHandler {
179
+ override fun onSuccess() {
180
+ println("Successfully kicked user $userId out of the room")
181
+ // After a successful kick, you will receive an onAudienceLeft event
182
+ }
183
+
184
+ override fun onFailure(code: Int, desc: String) {
185
+ println("Failed to kick user $userId: $desc")
186
+ }
187
+ })
188
+ }
189
+ }
190
+ ```
191
+
192
+ #### 4.2 Set or Revoke Administrator Status
193
+
194
+ Use the `setAdministrator` and `revokeAdministrator` methods to manage a user's administrator status.
195
+ ``` kotlin
196
+ class AudienceManager {
197
+ /// Promote user to administrator
198
+ fun promoteToAdmin(userId: String) {
199
+ audienceStore.setAdministrator(userId, object : CompletionHandler {
200
+ override fun onSuccess() {
201
+ println("Successfully promoted user $userId to administrator")
202
+ }
203
+
204
+ override fun onFailure(code: Int, desc: String) {
205
+ println("Failed to set administrator: $desc")
206
+ }
207
+ })
208
+ }
209
+
210
+ /// Revoke user's administrator status
211
+ fun revokeAdmin(userId: String) {
212
+ audienceStore.revokeAdministrator(userId, object : CompletionHandler {
213
+ override fun onSuccess() {
214
+ println("Successfully revoked administrator status for user $userId")
215
+ }
216
+
217
+ override fun onFailure(code: Int, desc: String) {
218
+ println("Failed to revoke administrator: $desc")
219
+ }
220
+ })
221
+ }
222
+ }
223
+ ```
224
+
225
+ ## Advanced Features
226
+
227
+ ### Display a Welcome Message in the Barrage Area When a Viewer Joins
228
+
229
+ When a new viewer enters the live room, a welcome message such as `"Welcome [user nickname] to the live room"` is automatically displayed locally in the barrage/chat area.
230
+
231
+ #### Implementation
232
+
233
+ Add a listener for the audience join event `LiveAudienceListener.onAudienceJoined` in `LiveAudienceStore` to receive real-time notifications when a new viewer joins. When triggered, extract the new viewer's nickname and call the `appendLocalTip` method of BarrageStore to insert the message locally.
234
+ ``` kotlin
235
+ import io.trtc.tuikit.atomicxcore.api.live.LiveAudienceListener
236
+ import io.trtc.tuikit.atomicxcore.api.live.LiveAudienceStore
237
+ import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
238
+ import io.trtc.tuikit.atomicxcore.api.barrage.Barrage
239
+ import io.trtc.tuikit.atomicxcore.api.barrage.BarrageStore
240
+ import io.trtc.tuikit.atomicxcore.api.barrage.BarrageType
241
+
242
+ class LiveRoomManager(
243
+ private val liveId: String
244
+ ) {
245
+
246
+ init {
247
+ // Initialize two core managers
248
+ setupWelcomeMessageFlow()
249
+ }
250
+
251
+ private fun setupWelcomeMessageFlow() {
252
+ // 1. Get an instance of LiveAudienceStore
253
+ val audienceStore = LiveAudienceStore.create(liveId)
254
+
255
+ // 2. Get an instance of BarrageStore (this will be the same instance due to internal mechanisms)
256
+ val barrageStore = BarrageStore.create(liveId)
257
+
258
+ // 3. Subscribe to audience events
259
+ audienceStore.addLiveAudienceListener(object : LiveAudienceListener() {
260
+ override fun onAudienceJoined(audience: LiveUserInfo) {
261
+ // 4. Create a local tip message
262
+ val welcomeTip = Barrage().apply {
263
+ liveID = liveId
264
+ messageType = BarrageType.TEXT
265
+ textContent = "Welcome ${audience.userName} to the live room!"
266
+ }
267
+
268
+ // 5. Use BarrageStore's method to insert it into the barrage list
269
+ barrageStore.appendLocalTip(welcomeTip)
270
+ }
271
+ })
272
+ }
273
+ }
274
+ ```
275
+
276
+ ## API Documentation
277
+
278
+ For detailed information on all public interfaces, properties, and methods of [LiveAudienceStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-live-audience-store/index.html) and its related classes, refer to the official API documentation included with the [AtomicX Core](https://tencent-rtc.github.io/TUIKit_Android/index.html) framework. The relevant Stores used in this document are as follows:
279
+ <table>
280
+ <tr>
281
+ <td rowspan="1" colSpan="1" >**Store/Component**</td>
282
+
283
+ <td rowspan="1" colSpan="1" >**Feature Description**</td>
284
+
285
+ <td rowspan="1" colSpan="1" >**API Documentation**</td>
286
+ </tr>
287
+
288
+ <tr>
289
+ <td rowspan="1" colSpan="1" >LiveCoreView</td>
290
+
291
+ <td rowspan="1" colSpan="1" >Core view component for live video stream display and interaction: responsible for video stream rendering and view widget handling, supporting scenarios such as host streaming, audience co-hosting, and host-to-host connection.</td>
292
+
293
+ <td rowspan="1" colSpan="1" >[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.view/-live-core-view/index.html)</td>
294
+ </tr>
295
+
296
+ <tr>
297
+ <td rowspan="1" colSpan="1" >LiveAudienceStore</td>
298
+
299
+ <td rowspan="1" colSpan="1" >Audience management: obtain real-time audience list (ID / name / avatar), count audience numbers, and listen for audience join/leave events.</td>
300
+
301
+ <td rowspan="1" colSpan="1" >[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.view/-live-core-view/index.html)</td>
302
+ </tr>
303
+
304
+ <tr>
305
+ <td rowspan="1" colSpan="1" >BarrageStore</td>
306
+
307
+ <td rowspan="1" colSpan="1" >Barrage feature: send text/custom barrage, maintain barrage list, and listen to barrage status in real time.</td>
308
+
309
+ <td rowspan="1" colSpan="1" >[API Documentation](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.barrage/-barrage-store/index.html)</td>
310
+ </tr>
311
+ </table>
312
+
313
+
314
+ ## FAQs
315
+
316
+ ### How is the online audience count (audienceCount) in LiveAudienceState updated? What are the timing and frequency?
317
+
318
+ The update of `audienceCount` is not always strictly real-time. The mechanism is as follows:
319
+ - **Active Join/Leave**: When a user actively joins or leaves the live room, the audience count change notification is triggered instantly. You will quickly observe the change in `audienceCount` in `LiveAudienceState`.
320
+
321
+ - **Unexpected Disconnection**: If a user disconnects unexpectedly due to network issues, app crashes, and so on, the system determines their actual status using a heartbeat mechanism. Only when the user has no heartbeat for 90 consecutive seconds does the system consider them offline and trigger a count change notification.
322
+
323
+ - **Update Mechanism and Frequency Control:**
324
+
325
+ - Whether triggered instantly or with a delay, all audience count change notifications are broadcast as messages within the room.
326
+
327
+ - There is an upper limit to the total number of messages per second in a room, with a per-room message rate limit of 40 messages per second.
328
+
329
+ - Key Point: In scenarios with extremely high message traffic, such as "barrage storms" or rapid-fire gifting, if the message rate in the room exceeds the 40 messages/second threshold, to ensure the delivery of core messages (such as barrage), audience count change messages may be dropped by the rate-limiting policy.
330
+
331
+ - **What does this mean for developers?**
332
+
333
+
334
+ `audienceCount` is a near real-time, high-precision estimate, but in extreme high-concurrency scenarios, there may be brief delays or data loss. We recommend using it for UI display only, and not as the sole basis for billing, statistics, or other scenarios requiring absolute accuracy.