@tencent-rtc/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 (54) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/chatuikit/android/integration.md +499 -203
  3. package/resource/doc/chatuikit/android/workflow.md +713 -0
  4. package/resource/doc/chatuikit/flutter/integration.md +1 -1
  5. package/resource/doc/livekit/voice/android/voice-audience-list.md +334 -0
  6. package/resource/doc/livekit/voice/android/voice-audio-effect.md +380 -0
  7. package/resource/doc/livekit/voice/android/voice-barrage.md +565 -0
  8. package/resource/doc/livekit/voice/android/voice-co-guest-interaction.md +745 -0
  9. package/resource/doc/livekit/voice/android/voice-gift.md +822 -0
  10. package/resource/doc/livekit/voice/android/voice-host-interaction.md +703 -0
  11. package/resource/doc/livekit/voice/android/voice-integration.md +940 -0
  12. package/resource/doc/livekit/voice/android/voice-room-list.md +575 -0
  13. package/resource/doc/livekit/voice/flutter/voice-co-guest-interaction.md +675 -0
  14. package/resource/doc/livekit/voice/flutter/voice-integration.md +936 -0
  15. package/resource/doc/livekit/voice/ios/voice-audience-list.md +339 -0
  16. package/resource/doc/livekit/voice/ios/voice-audio-effect.md +370 -0
  17. package/resource/doc/livekit/voice/ios/voice-barrage.md +517 -0
  18. package/resource/doc/livekit/voice/ios/voice-co-guest-interaction.md +708 -0
  19. package/resource/doc/livekit/voice/ios/voice-gift.md +783 -0
  20. package/resource/doc/livekit/voice/ios/voice-host-interaction.md +770 -0
  21. package/resource/doc/livekit/voice/ios/voice-integration.md +898 -0
  22. package/resource/doc/livekit/voice/ios/voice-room-list.md +485 -0
  23. package/resource/doc/roomkit/vue/integration.md +179 -288
  24. package/resource/doc/roomkit/vue/workflow.md +499 -253
  25. package/resource/doc/tuicallkit/android/integration.md +539 -83
  26. package/resource/doc/tuicallkit/android/workflow.md +441 -0
  27. package/tools/common/present-scenario-choice.js +16 -0
  28. package/tools/common/present-scenario-choice.js.map +1 -0
  29. package/tools/definitions/get_native_call_uikit_integration_def.js +25 -9
  30. package/tools/definitions/get_native_call_uikit_integration_def.js.map +1 -1
  31. package/tools/definitions/get_native_chat_uikit_integration_def.js +36 -14
  32. package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -1
  33. package/tools/definitions/get_native_live_uikit_integration_def.js +55 -29
  34. package/tools/definitions/get_native_live_uikit_integration_def.js.map +1 -1
  35. package/tools/definitions/get_native_live_uikit_interaction_def.js +43 -54
  36. package/tools/definitions/get_native_live_uikit_interaction_def.js.map +1 -1
  37. package/tools/definitions/get_web_room_feature_detail_def.js +52 -55
  38. package/tools/definitions/get_web_room_feature_detail_def.js.map +1 -1
  39. package/tools/definitions/get_web_room_uikit_integration_def.js +41 -25
  40. package/tools/definitions/get_web_room_uikit_integration_def.js.map +1 -1
  41. package/tools/definitions/present_scenario_choice_def.js +53 -0
  42. package/tools/definitions/present_scenario_choice_def.js.map +1 -0
  43. package/tools/definitions/record_prompt_def.js +26 -21
  44. package/tools/definitions/record_prompt_def.js.map +1 -1
  45. package/tools/definitions/record_result_def.js +20 -4
  46. package/tools/definitions/record_result_def.js.map +1 -1
  47. package/tools/index.js +2 -0
  48. package/tools/index.js.map +1 -1
  49. package/tools/live/get-native-live-uikit-integration.js +110 -34
  50. package/tools/live/get-native-live-uikit-integration.js.map +1 -1
  51. package/tools/live/get_native_live_uikit_interaction.js +128 -35
  52. package/tools/live/get_native_live_uikit_interaction.js.map +1 -1
  53. package/utils/report-cls-client.js +1 -1
  54. package/utils/report-es-client.js +1 -1
@@ -0,0 +1,745 @@
1
+ AtomicXCore provides the [CoGuestStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-co-guest-store/index.html) and [LiveSeatStore](https://tencent-rtc.github.io/TUIKit_Android/-atomic-x%20-core%20-a-p-i/io.trtc.tuikit.atomicxcore.api.live/-live-seat-store/index.html) modules, which are designed to streamline the entire audience co-hosting workflow for live streaming scenarios. You do not need to manage complex state synchronization or signaling logic—simply invoke a few intuitive methods to enable seamless audio and video interactions between hosts and audience members. This guide explains how to quickly implement voice co-hosting features in your Android app using `CoGuestStore` and `LiveSeatStore`.
2
+
3
+ ![](https://write-document-release-1258344699.cos.ap-guangzhou.tencentcos.cn/100027182498/a85df260ca0611f09e745254007c27c5.png)
4
+
5
+
6
+ ## Core Scenarios
7
+
8
+ `CoGuestStore` and `LiveSeatStore` support the following primary live streaming scenarios:
9
+ - **Audience Request to Join Mic**: Audience members can request to join the mic; hosts can approve or reject these requests.
10
+
11
+ - **Host Invites Audience to Mic**: The host can proactively invite any viewer in the live room to join the mic.
12
+
13
+ - **Host Manages Mic Seats**: Hosts can manage mic seat users, including removing users, muting, and locking mic seats.
14
+
15
+
16
+ ## Implementation
17
+
18
+ ### Step 1: Component Integration
19
+
20
+ Refer to the [Quick Start](https://write.woa.com/document/194571595678187521) guide to integrate **AtomicXCore** into your project.
21
+
22
+ ### Step 2: Implement Audience Mic-Link Request
23
+
24
+ #### Audience Side Implementation
25
+
26
+ As an audience member, your main tasks are **initiating a request, handling the response**, and **leaving the mic proactively**.
27
+ 1. **Initiate Mic-Link Request**
28
+
29
+
30
+ When the user taps the "Request to Co-host" button, call the `applyForSeat` method:
31
+
32
+ ``` java
33
+ import io.trtc.tuikit.atomicxcore.api.CompletionHandler
34
+ import io.trtc.tuikit.atomicxcore.api.live.CoGuestStore
35
+
36
+ val liveId = "Room ID"
37
+ val guestStore = CoGuestStore.create(liveId)
38
+
39
+ // User taps "Request to Co-host"
40
+ fun requestToConnect() {
41
+ // timeout: request timeout, e.g., 30 seconds
42
+ guestStore.applyForSeat(-1, 30, null, object : CompletionHandler {
43
+ override fun onSuccess() {
44
+ print("Co-hosting request sent, waiting for host to respond...")
45
+ }
46
+
47
+ override fun onFailure(code: Int, desc: String) {
48
+ print("Failed to send request: $desc")
49
+ }
50
+ })
51
+ }
52
+ ```
53
+ 2. **Listen for Host Response**
54
+
55
+
56
+ Subscribe to `GuestListener` to handle the host’s approval or rejection:
57
+
58
+ ``` java
59
+ import io.trtc.tuikit.atomicxcore.api.device.DeviceStore
60
+ import io.trtc.tuikit.atomicxcore.api.live.GuestListener
61
+ import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
62
+
63
+ // Add listener during Activity/Fragment initialization
64
+ fun subscribeGuestEvents() {
65
+ val guestListener = object : GuestListener() {
66
+ override fun onGuestApplicationResponded(isAccept: Boolean, hostUser: LiveUserInfo) {
67
+ if (isAccept) {
68
+ print("Host ${hostUser.userName} approved your request. Preparing to join mic.")
69
+ // 1. Enable camera and microphone
70
+ DeviceStore.shared().openLocalCamera(true, null)
71
+ DeviceStore.shared().openLocalMicrophone(null)
72
+ // 2. Update UI, e.g., disable request button, show co-hosting status
73
+ } else {
74
+ print("Host ${hostUser.userName} rejected your request.")
75
+ // Notify user of rejection
76
+ }
77
+ }
78
+ }
79
+ guestStore.addGuestListener(guestListener)
80
+ }
81
+ ```
82
+ 3. **Leave Mic Proactively**
83
+
84
+
85
+ To leave the mic seat and revert to audience status, call `disconnect`:
86
+
87
+ ``` java
88
+ // User taps "Leave Mic"
89
+ fun leaveSeat() {
90
+ guestStore.disconnect(object : CompletionHandler {
91
+ override fun onSuccess() {
92
+ print("Successfully left the mic")
93
+ }
94
+
95
+ override fun onFailure(code: Int, desc: String) {
96
+ print("Failed to leave mic: $desc")
97
+ }
98
+ })
99
+ }
100
+ ```
101
+ 4. **(Optional) Cancel Request**
102
+
103
+
104
+ If the audience member wishes to withdraw their request before the host responds, call `cancelApplication`:
105
+
106
+ ``` java
107
+ // User taps "Cancel Request" while waiting
108
+ fun cancelRequest() {
109
+ guestStore.cancelApplication(object : CompletionHandler {
110
+ override fun onSuccess() {
111
+ print("Request cancelled")
112
+ }
113
+
114
+ override fun onFailure(code: Int, desc: String) {
115
+ print("Failed to cancel request: $desc")
116
+ }
117
+ })
118
+ }
119
+ ```
120
+
121
+ #### Host Side Implementation
122
+
123
+ As the host, your main tasks are **receiving requests, displaying the request list**, and **handling requests**.
124
+ 1. **Listen for New Mic-Link Requests**
125
+
126
+
127
+ Subscribe to `HostListener` to receive notifications when an audience member requests to join the mic:
128
+
129
+ ``` java
130
+ import io.trtc.tuikit.atomicxcore.api.live.CoGuestStore
131
+ import io.trtc.tuikit.atomicxcore.api.live.HostListener
132
+ import io.trtc.tuikit.atomicxcore.api.live.LiveUserInfo
133
+
134
+ val liveId = "Room ID"
135
+ val guestStore = CoGuestStore.create(liveId)
136
+
137
+ // Subscribe to host events
138
+ val hostListener = object : HostListener() {
139
+ override fun onGuestApplicationReceived(guestUser: LiveUserInfo) {
140
+ print("Received co-hosting request from ${guestUser.userName}")
141
+ // Update UI, e.g., show notification on "Request List" button
142
+ }
143
+ // ... Override other needed callback methods
144
+ }
145
+ guestStore.addHostListener(hostListener)
146
+ ```
147
+ 2. **Display Request List**
148
+
149
+
150
+ Subscribe to the `applicants` property in `CoGuestStore`’s state to update the UI in real time:
151
+
152
+ ``` java
153
+ import kotlinx.coroutines.CoroutineScope
154
+ import kotlinx.coroutines.Dispatchers
155
+ import kotlinx.coroutines.launch
156
+
157
+ // Subscribe to state changes
158
+ fun observeApplicants() {
159
+ CoroutineScope(Dispatchers.Main).launch {
160
+ guestStore.coGuestState.applicants.collect { applicants ->
161
+ print("Current number of applicants: ${applicants.size}")
162
+ // Update "Applicant List" UI
163
+ }
164
+ }
165
+ }
166
+ ```
167
+ 3. **Handle Mic-Link Requests**
168
+
169
+
170
+ Approve or reject requests using the following methods:
171
+
172
+ ``` java
173
+ // Host taps "Approve"
174
+ fun accept(userId: String) {
175
+ guestStore.acceptApplication(
176
+ userId,
177
+ object : CompletionHandler {
178
+ override fun onSuccess() {
179
+ print("Approved $userId's request. They are joining the mic.")
180
+ }
181
+
182
+ override fun onFailure(code: Int, desc: String) {
183
+ print("Failed to approve request: $desc")
184
+ }
185
+ }
186
+ )
187
+ }
188
+
189
+ // Host taps "Reject"
190
+ fun reject(userId: String) {
191
+ guestStore.rejectApplication(
192
+ userId,
193
+ object : CompletionHandler {
194
+ override fun onSuccess() {
195
+ print("Rejected $userId's request")
196
+ }
197
+
198
+ override fun onFailure(code: Int, desc: String) {
199
+ print("Failed to reject request: $desc")
200
+ }
201
+ }
202
+ )
203
+ }
204
+ ```
205
+
206
+ ### Step 3: Implement Host-Initiated Mic-Link Invitation
207
+
208
+ #### Host Side Implementation
209
+ 1. **Invite Audience Mic**
210
+
211
+
212
+ To invite an audience member, call `inviteToSeat`:
213
+
214
+ ``` java
215
+ // Host selects audience and sends invitation
216
+ fun invite(userId: String) {
217
+ // timeout: invitation timeout
218
+ guestStore.inviteToSeat(userId, -1, 30, null, object : CompletionHandler {
219
+ override fun onSuccess() {
220
+ print("Invitation sent to $userId, waiting for response...")
221
+ }
222
+
223
+ override fun onFailure(code: Int, desc: String) {
224
+ print("Failed to send invitation: $desc")
225
+ }
226
+ })
227
+ }
228
+ ```
229
+ 2. **Listen for Audience Response**
230
+
231
+
232
+ Handle the audience member’s response via `HostListener`:
233
+
234
+ ``` java
235
+ // Add to hostListener implementation
236
+ override fun onHostInvitationResponded(isAccept: Boolean, guestUser: LiveUserInfo) {
237
+ if (isAccept) {
238
+ print("Audience ${guestUser.userName} accepted your invitation")
239
+ } else {
240
+ print("Audience ${guestUser.userName} rejected your invitation")
241
+ }
242
+ }
243
+ ```
244
+
245
+ #### Audience Side Implementation
246
+ 1. **Receive Host Invitation**
247
+
248
+
249
+ Listen for invitations via `GuestListener`:
250
+
251
+ ``` java
252
+ // Add to guestListener implementation
253
+ override fun onHostInvitationReceived(hostUser: LiveUserInfo) {
254
+ print("Received co-hosting invitation from host ${hostUser.userName}")
255
+ // Show dialog for user to accept or reject
256
+ }
257
+ ```
258
+ 2. **Respond to Invitation**
259
+
260
+
261
+ Invoke the appropriate method based on the user’s choice:
262
+
263
+ ``` java
264
+ val inviterId = "Host ID who sent the invitation" // From onHostInvitationReceived
265
+
266
+ // User taps "Accept"
267
+ fun accept() {
268
+ guestStore.acceptInvitation(inviterId, object : CompletionHandler {
269
+ override fun onSuccess() {
270
+ // Enable microphone
271
+ DeviceStore.shared().openLocalMicrophone(null)
272
+ }
273
+
274
+ override fun onFailure(code: Int, desc: String) {
275
+ print("Failed to accept invitation: $desc")
276
+ }
277
+ })
278
+ }
279
+
280
+ // User taps "Reject"
281
+ fun reject() {
282
+ guestStore.rejectInvitation(inviterId, object : CompletionHandler {
283
+ override fun onSuccess() {
284
+ // ...
285
+ }
286
+ override fun onFailure(code: Int, desc: String) {
287
+ // ...
288
+ }
289
+ })
290
+ }
291
+ ```
292
+
293
+ ## Advanced Features
294
+
295
+ Once a user is on mic, the host may need to manage mic seats. The following features are primarily provided by `LiveSeatStore`, which functions with `CoGuestStore`.
296
+
297
+ ### On-Mic Users Control Their Own Microphone
298
+
299
+ On-mic users (including the host) can control their own microphone mute status via the `LiveSeatStore` interface.
300
+
301
+ #### Implementation
302
+ - **Mute:** Call `muteMicrophone()`. This is a one-way request with no callback.
303
+
304
+ - **Unmute:** Call `unmuteMicrophone(completion)`.
305
+
306
+
307
+ #### Example Code
308
+ ``` java
309
+ import io.trtc.tuikit.atomicxcore.api.live.LiveSeatStore
310
+
311
+ val seatStore = LiveSeatStore.create(liveId)
312
+
313
+ seatStore.muteMicrophone() // Mute
314
+
315
+ seatStore.unmuteMicrophone(null) // Unmute
316
+ ```
317
+
318
+ #### unmuteMicrophone Parameters
319
+ <table>
320
+ <tr>
321
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
322
+
323
+ <td rowspan="1" colSpan="1" >**Type**</td>
324
+
325
+ <td rowspan="1" colSpan="1" >**Description**</td>
326
+ </tr>
327
+
328
+ <tr>
329
+ <td rowspan="1" colSpan="1" >`completion`</td>
330
+
331
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
332
+
333
+ <td rowspan="1" colSpan="1" >Callback after operation completes.</td>
334
+ </tr>
335
+ </table>
336
+
337
+
338
+ ### Host Remotely Controls Mic Seat User’s Microphone
339
+
340
+ Hosts can forcibly mute or invite mic seat users to unmute.
341
+
342
+ #### Implementation
343
+ 1. **Force Mute (Lock):** Hosts call `closeRemoteMicrophone` to mute and lock a user’s microphone. The user receives the `onLocalMicrophoneClosedByAdmin` event in `LiveSeatListener`, and their "Unmute Microphone" button should be disabled.
344
+
345
+ 2. **Invite to Unmute (Unlock):** Hosts call `openRemoteMicrophone` to unlock mic permissions. The user receives the `onLocalMicrophoneOpenedByAdmin` event and can unmute themselves.
346
+
347
+ 3. **User Unmutes Themselves:** After receiving an unlock notification, the user must call `unmuteMicrophone()` to resume audio transmission.
348
+
349
+
350
+ #### Example Code
351
+
352
+ ##### Host Side
353
+ ``` java
354
+ import io.trtc.tuikit.atomicxcore.api.CompletionHandler
355
+ import io.trtc.tuikit.atomicxcore.api.live.DeviceControlPolicy
356
+
357
+ val targetUserId = "userD"
358
+
359
+ // 1. Force mute and lock
360
+ seatStore.closeRemoteMicrophone(targetUserId, object : CompletionHandler {
361
+ override fun onSuccess() {
362
+ print("$targetUserId has been muted and locked")
363
+ }
364
+ override fun onFailure(code: Int, desc: String) {
365
+ print("Operation failed: $desc")
366
+ }
367
+ })
368
+
369
+ // 2. Unlock mic permissions (userD remains muted)
370
+ seatStore.openRemoteMicrophone(targetUserId, DeviceControlPolicy.UNLOCK_ONLY, object : CompletionHandler {
371
+ override fun onSuccess() {
372
+ print("Invited $targetUserId to unmute (unlocked)")
373
+ }
374
+ override fun onFailure(code: Int, desc: String) {
375
+ print("Operation failed: $desc")
376
+ }
377
+ })
378
+ ```
379
+
380
+ ##### Audience Side
381
+ ``` java
382
+ import io.trtc.tuikit.atomicxcore.api.live.DeviceControlPolicy
383
+ import io.trtc.tuikit.atomicxcore.api.live.LiveSeatListener
384
+
385
+ // userD listens for host actions
386
+ val seatListener = object : LiveSeatListener() {
387
+ override fun onLocalMicrophoneClosedByAdmin() {
388
+ print("Muted by host")
389
+ }
390
+
391
+ override fun onLocalMicrophoneOpenedByAdmin(policy: DeviceControlPolicy) {
392
+ print("Host has unlocked mute")
393
+ }
394
+ }
395
+ seatStore.addLiveSeatEventListener(seatListener)
396
+ ```
397
+
398
+ #### closeRemoteMicrophone Parameters
399
+ <table>
400
+ <tr>
401
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
402
+
403
+ <td rowspan="1" colSpan="1" >**Type**</td>
404
+
405
+ <td rowspan="1" colSpan="1" >**Description**</td>
406
+ </tr>
407
+
408
+ <tr>
409
+ <td rowspan="1" colSpan="1" >`userID`</td>
410
+
411
+ <td rowspan="1" colSpan="1" >`String`</td>
412
+
413
+ <td rowspan="1" colSpan="1" >The user ID of the target user.</td>
414
+ </tr>
415
+
416
+ <tr>
417
+ <td rowspan="1" colSpan="1" >`completion`</td>
418
+
419
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
420
+
421
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
422
+ </tr>
423
+ </table>
424
+
425
+
426
+ #### openRemoteMicrophone Parameters
427
+ <table>
428
+ <tr>
429
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
430
+
431
+ <td rowspan="1" colSpan="1" >**Type**</td>
432
+
433
+ <td rowspan="1" colSpan="1" >**Description**</td>
434
+ </tr>
435
+
436
+ <tr>
437
+ <td rowspan="1" colSpan="1" >`userID`</td>
438
+
439
+ <td rowspan="1" colSpan="1" >`String`</td>
440
+
441
+ <td rowspan="1" colSpan="1" >The user ID of the target user.</td>
442
+ </tr>
443
+
444
+ <tr>
445
+ <td rowspan="1" colSpan="1" >`completion`</td>
446
+
447
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
448
+
449
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
450
+ </tr>
451
+ </table>
452
+
453
+
454
+ ### Host Removes On-Mic User from the Seat
455
+
456
+ #### Implementation
457
+ 1. **Remove User from Mic Seat:** Hosts call `kickUserOutOfSeat` to forcibly remove a user from a mic seat.
458
+
459
+ 2. **Event Notification:** The removed user receives the `onKickedOffSeat` event in `GuestListener`.
460
+
461
+
462
+ #### Example Code
463
+ ``` java
464
+ // Remove "userB" from mic seat
465
+ val targetUserId = "userB"
466
+ seatStore.kickUserOutOfSeat(targetUserId, object : CompletionHandler {
467
+ override fun onSuccess() {
468
+ print("$targetUserId has been removed from the mic seat")
469
+ }
470
+ override fun onFailure(code: Int, desc: String) {
471
+ print("Failed to remove user: $desc")
472
+ }
473
+ })
474
+
475
+ // "userB" receives the event in GuestListener
476
+ override fun onKickedOffSeat(seatIndex: Int, hostUser: LiveUserInfo) {
477
+ // Show notification
478
+ }
479
+ ```
480
+
481
+ #### kickUserOutOfSeat Parameters
482
+ <table>
483
+ <tr>
484
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
485
+
486
+ <td rowspan="1" colSpan="1" >**Type**</td>
487
+
488
+ <td rowspan="1" colSpan="1" >**Description**</td>
489
+ </tr>
490
+
491
+ <tr>
492
+ <td rowspan="1" colSpan="1" >`userID`</td>
493
+
494
+ <td rowspan="1" colSpan="1" >`String`</td>
495
+
496
+ <td rowspan="1" colSpan="1" >The user ID of the user to remove.</td>
497
+ </tr>
498
+
499
+ <tr>
500
+ <td rowspan="1" colSpan="1" >`completion`</td>
501
+
502
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
503
+
504
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
505
+ </tr>
506
+ </table>
507
+
508
+
509
+ ### Host Locks and Unlocks Mic Seats
510
+
511
+ Hosts can lock or unlock specific mic seats.
512
+
513
+ #### Implementation
514
+ 1. **Lock Mic Seat:** Call `lockSeat` to lock a mic seat at the specified index. Locked seats cannot be occupied via `applyForSeat` or `takeSeat`.
515
+
516
+ 2. **Unlock Mic Seat:** Call `unlockSeat` to make the seat available again.
517
+
518
+
519
+ #### Example Code
520
+ ``` java
521
+ // Lock mic seat 2
522
+ seatStore.lockSeat(2, object : CompletionHandler {
523
+ override fun onSuccess() {
524
+ print("Mic seat 2 locked")
525
+ }
526
+ override fun onFailure(code: Int, desc: String) {
527
+ print("Failed to lock: $desc")
528
+ }
529
+ })
530
+
531
+ // Unlock mic seat 2
532
+ seatStore.unlockSeat(2, object : CompletionHandler {
533
+ override fun onSuccess() {
534
+ print("Mic seat 2 unlocked")
535
+ }
536
+ override fun onFailure(code: Int, desc: String) {
537
+ print("Failed to unlock: $desc")
538
+ }
539
+ })
540
+ ```
541
+
542
+ #### lockSeat Parameters
543
+ <table>
544
+ <tr>
545
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
546
+
547
+ <td rowspan="1" colSpan="1" >**Type**</td>
548
+
549
+ <td rowspan="1" colSpan="1" >**Description**</td>
550
+ </tr>
551
+
552
+ <tr>
553
+ <td rowspan="1" colSpan="1" >`seatIndex`</td>
554
+
555
+ <td rowspan="1" colSpan="1" >`Int`</td>
556
+
557
+ <td rowspan="1" colSpan="1" >Index of the mic seat to lock.</td>
558
+ </tr>
559
+
560
+ <tr>
561
+ <td rowspan="1" colSpan="1" >`completion`</td>
562
+
563
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
564
+
565
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
566
+ </tr>
567
+ </table>
568
+
569
+
570
+ #### unlockSeat Parameters
571
+ <table>
572
+ <tr>
573
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
574
+
575
+ <td rowspan="1" colSpan="1" >**Type**</td>
576
+
577
+ <td rowspan="1" colSpan="1" >**Description**</td>
578
+ </tr>
579
+
580
+ <tr>
581
+ <td rowspan="1" colSpan="1" >`seatIndex`</td>
582
+
583
+ <td rowspan="1" colSpan="1" >`Int`</td>
584
+
585
+ <td rowspan="1" colSpan="1" >Index of the mic seat to unlock.</td>
586
+ </tr>
587
+
588
+ <tr>
589
+ <td rowspan="1" colSpan="1" >`completion`</td>
590
+
591
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
592
+
593
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
594
+ </tr>
595
+ </table>
596
+
597
+
598
+ ### Move Mic Seats
599
+
600
+ Hosts and mic seat users can call `moveUserToSeat` to move users between mic seats.
601
+
602
+ #### Implementation
603
+ 1. **Host Moves User to Mic Seat:** The host can use this API to move any user to a specified mic seat. Provide the target user's `userID`, the target seat index as `targetIndex`, and use the `policy` parameter to specify the seat movement strategy if the target seat is occupied (see parameter details below).
604
+
605
+ 2. **On-Mic User Moves Themselves:** On-mic users can also call this API to move themselves. In this case, `userID` must be the user's own ID, `targetIndex` is the desired new seat index, and the `policy` parameter is ignored. If the target seat is occupied, the move fails with an error.
606
+
607
+
608
+ #### Example Code
609
+ ``` java
610
+ import io.trtc.tuikit.atomicxcore.api.CompletionHandler
611
+ import io.trtc.tuikit.atomicxcore.api.live.MoveSeatPolicy
612
+
613
+ seatStore.moveUserToSeat("userC",
614
+ newSeatIndex,
615
+ MoveSeatPolicy.ABORT_WHEN_OCCUPIED,
616
+ object : CompletionHandler {
617
+ override fun onSuccess() {
618
+ print("Successfully moved to mic seat $newSeatIndex")
619
+ }
620
+ override fun onFailure(code: Int, desc: String) {
621
+ print("Failed to switch seat, seat may be occupied: $desc")
622
+ }
623
+ })
624
+ ```
625
+
626
+ #### moveUserToSeat Parameters
627
+ <table>
628
+ <tr>
629
+ <td rowspan="1" colSpan="1" >**Parameter**</td>
630
+
631
+ <td rowspan="1" colSpan="1" >**Type**</td>
632
+
633
+ <td rowspan="1" colSpan="1" >**Description**</td>
634
+ </tr>
635
+
636
+ <tr>
637
+ <td rowspan="1" colSpan="1" >`userID`</td>
638
+
639
+ <td rowspan="1" colSpan="1" >`String`</td>
640
+
641
+ <td rowspan="1" colSpan="1" >The user ID of the user to move.</td>
642
+ </tr>
643
+
644
+ <tr>
645
+ <td rowspan="1" colSpan="1" >`targetIndex`</td>
646
+
647
+ <td rowspan="1" colSpan="1" >`Int`</td>
648
+
649
+ <td rowspan="1" colSpan="1" >Target mic seat index.</td>
650
+ </tr>
651
+
652
+ <tr>
653
+ <td rowspan="1" colSpan="1" >`policy`</td>
654
+
655
+ <td rowspan="1" colSpan="1" >`MoveSeatPolicy?`</td>
656
+
657
+ <td rowspan="1" colSpan="1" >Seat movement policy if the target seat is occupied:<br>- `abortWhenOccupied`: Abort move if seat is occupied (default)<br>- `forceReplace`: Force replace the user on the target seat; replaced user will be removed<br>- `swapPosition`: Swap positions with the user on the target seat.</td>
658
+ </tr>
659
+
660
+ <tr>
661
+ <td rowspan="1" colSpan="1" >`completion`</td>
662
+
663
+ <td rowspan="1" colSpan="1" >`CompletionHandler?`</td>
664
+
665
+ <td rowspan="1" colSpan="1" >Callback after request completes.</td>
666
+ </tr>
667
+ </table>
668
+
669
+
670
+ ## API Documentation
671
+
672
+ For detailed information about all public interfaces, properties, and methods of [CoGuestStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/cogueststore), [LiveSeatStore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore/liveseatstore), and related classes, refer to the official [AtomicXCore](https://tencent-rtc.github.io/TUIKit_iOS/documentation/atomicxcore) framework API documentation. The relevant stores used in this guide are as follows:
673
+ <table>
674
+ <tr>
675
+ <td rowspan="1" colSpan="1" >**Store/Component**</td>
676
+
677
+ <td rowspan="1" colSpan="1" >**Feature Description**</td>
678
+
679
+ <td rowspan="1" colSpan="1" >**API Documentation**</td>
680
+ </tr>
681
+
682
+ <tr>
683
+ <td rowspan="1" colSpan="1" >CoGuestStore</td>
684
+
685
+ <td rowspan="1" colSpan="1" >Audience co-hosting management: co-hosting requests/invitations, approval/rejection, co-host member permission control (microphone/camera), state synchronization.</td>
686
+
687
+ <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.live/-co-guest-store/index.html)</td>
688
+ </tr>
689
+
690
+ <tr>
691
+ <td rowspan="1" colSpan="1" >LiveSeatStore</td>
692
+
693
+ <td rowspan="1" colSpan="1" >Mic seat management: mute/unmute, lock/unlock mic seat, remove user from mic, remote microphone control, mic seat list state monitoring.</td>
694
+
695
+ <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.live/-live-seat-store/index.html)</td>
696
+ </tr>
697
+ </table>
698
+
699
+
700
+ ## FAQs
701
+
702
+ ### What are the differences between voice room co-hosting and video live co-hosting?
703
+
704
+ The main differences are in business logic and UI design:
705
+ - `Video Live Streaming`**:** The video feed is central. Use `LiveCoreView` to render host and co-host video streams. The UI focuses on video layout, sizing, and overlays (such as nickname or placeholder images) via `VideoViewAdapter`. Both camera and microphone can be enabled.
706
+
707
+ - `Voice Room (Audio Chat Room)`**:** The mic seat grid is central. Do not use `LiveCoreView`; instead, build a grid UI (e.g., `RecyclerView`) based on `LiveSeatStore.state` (especially `seatList`). The UI displays each mic seat’s `SeatInfo`—occupied, muted, locked, or speaking—in real time. Only the microphone needs to be enabled.
708
+
709
+
710
+ ### How do I update mic seat information (such as occupancy and mute status) in the UI in real time?
711
+
712
+ Subscribe to the `seatList` property in `LiveSeatState`, which is a reactive `List<SeatInfo>`. When the array changes, update your mic seat UI. For each seat:
713
+ - Use `seatInfo.userInfo` for user details.
714
+
715
+ - Use `seatInfo.isLocked` to check if the seat is locked.
716
+
717
+ - Use `seatInfo.userInfo.microphoneStatus` for the user’s microphone status.
718
+
719
+
720
+ ### What is the difference between microphone interfaces in LiveSeatStore and DeviceStore?
721
+
722
+ `DeviceStore` manages the physical microphone device, while `LiveSeatStore` manages mic seat business logic (audio stream).
723
+
724
+ `DeviceStore:`
725
+ - `openLocalMicrophone`: Requests system permission and starts the microphone device for audio capture. This is a resource-intensive operation.
726
+
727
+ - `closeLocalMicrophone`: Stops audio capture and releases the microphone device.
728
+
729
+
730
+ `LiveSeatStore:`
731
+
732
+ - `muteMicrophone`: Mutes the audio stream sent to remote users; the microphone device remains active.
733
+
734
+ - `unmuteMicrophone`: Unmutes the audio stream.
735
+
736
+
737
+ **Recommended workflow:** "Open the device once, control mute/unmute while on mic"
738
+
739
+ 1. **When joining mic:** When an audience member successfully joins the mic, call `openLocalMicrophone` once to start the device.
740
+
741
+ 2. **While on mic:** All "mute" and "unmute" actions while on mic should use `muteMicrophone` and `unmuteMicrophone` to control the audio stream.
742
+
743
+ 3. **When leaving mic:** When leaving mic (e.g., calling `disconnect`), call `closeLocalMicrophone` to release the device.
744
+
745
+