RoomParticipantStore is a specialized module within AtomicXCore designed for managing room participants. It provides essential functionality for conference scenarios, enabling you to build a robust participant management system.
RoomParticipantStore is summarized in the table below:Core Concept | Type | Description |
data class | Represents the core data model for guests, encapsulating complete information and state management capabilities, including microphone control. Main functions include: basic guest information management (user ID, user name, avatar, room role), device state management (microphone status, camera status, screen sharing status, message status). | |
data class | Provides the data structure for managing participant states within the room, maintaining relevant status information. Main properties: participantList: Guest list.audienceList: Audience list.adminList: Admin list.localParticipant: Information about the current user in the room. | |
abstract class | Handles real-time events related to room members. | |
abstract class | Core class for participant control: manage panelist audio/video, participant roles, subscribe to RoomParticipantListener for real-time events. |
getParticipantList method of RoomParticipantStore to fetch the current panelist list.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantimport io.trtc.tuikit.atomicxcore.api.ListResultCompletionHandlerfun getParticipantList() {// Prerequisite: Join the room and create a RoomParticipantStore instance with the roomIDval roomID = "webinar_123456"val participantStore = RoomParticipantStore.create(roomID)// Retrieve panelist list (supports pagination with cursor)val initialCursor: String? = null // null starts from the first pageparticipantStore.getParticipantList(initialCursor, object : ListResultCompletionHandler<RoomParticipant> {override fun onSuccess(result: List<RoomParticipant>, cursor: String) {Log.d("Participant", "Panelist list retrieved, count: ${result.size}")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to retrieve panelist list [Error code: $code]: $desc")}})}
getAudienceList method of RoomParticipantStore to get the audience list.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.ListResultCompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserfun getAudienceList() {// Prerequisite: Join the room, and set roomType to WEBINARval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")// Retrieve audience list (supports pagination with cursor)val initialCursor: String? = nullparticipantStore.getAudienceList(cursor = initialCursor, completion = object : ListResultCompletionHandler<RoomUser> {override fun onSuccess(result: List<RoomUser>, cursor: String) {Log.d("Test", "Audience list retrieved, count: ${result.size}")}override fun onFailure(code: Int, desc: String) {Log.e("Test", "Failed to retrieve audience list [Error code: $code]: $desc")}})}
searchUsers method of RoomParticipantStore.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.ListResultCompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserfun searchUsers() {// Prerequisite: Join the roomval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")val keyword = "userName"participantStore.searchUsers(keyword = keyword, completion = object : ListResultCompletionHandler<RoomUser> {override fun onSuccess(result: List<RoomUser>, cursor: String) {Log.d("Test", "Room members found, count: ${result.size}")}override fun onFailure(code: Int, desc: String) {Log.e("Test", "Failed to search room members [Error code: $code]: $desc")}})}
promoteAudienceToParticipant in RoomParticipantStore to grant panelist privileges to an audience member.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStorefun promoteAudienceToParticipant(userID: String) {// Prerequisite: Join the roomval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")// Only host/admin can perform this actionparticipantStore.promoteAudienceToParticipant(userID = userID, completion = object : CompletionHandler {override fun onSuccess() {Log.d("Test", "User promoted to panelist successfully")}override fun onFailure(code: Int, desc: String) {Log.e("Test", "Failed to promote user to panelist [Error code: $code]: $desc")}})}
onAudiencePromotedToParticipant event in RoomParticipantListener to receive notifications when an audience member is promoted to panelist.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserfun subscribeParticipantEvent() {// Prerequisite: Join the room and create a RoomParticipantStore instanceval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")val listener = object : RoomParticipantListener() {override fun onAudiencePromotedToParticipant(userInfo: RoomUser) {Log.d("Test", "Audience promoted to panelist: $userInfo")}}participantStore.addRoomParticipantListener(listener)// Remove listener when no longer needed// participantStore.removeRoomParticipantListener(listener)}
demoteParticipantToAudience in RoomParticipantStore to move a panelist to the audience role.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStorefun demoteParticipantToAudience(userID: String) {// Prerequisite: Join the roomval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")// Only host/admin can perform this actionparticipantStore.demoteParticipantToAudience(userID = userID, completion = object : CompletionHandler {override fun onSuccess() {Log.d("Test", "User demoted to audience successfully")}override fun onFailure(code: Int, desc: String) {Log.e("Test", "Failed to demote user to audience [Error code: $code]: $desc")}})}
onParticipantDemotedToAudience event in RoomParticipantListener to get notified when a panelist is demoted.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserfun subscribeParticipantEvent() {// Prerequisite: Join the room and create a RoomParticipantStore instanceval participantStore = RoomParticipantStore.create(roomID = "webinar_123456")val listener = object : RoomParticipantListener() {override fun onParticipantDemotedToAudience(userInfo: RoomUser) {Log.d("Test", "Panelist demoted to audience: $userInfo")}}participantStore.addRoomParticipantListener(listener)// Remove listener when no longer needed// participantStore.removeRoomParticipantListener(listener)}
setAdmin method in RoomParticipantStore to assign or revoke admin privileges.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)// Assign admin privilegesfun setUserAsAdmin(userID: String) {participantStore.setAdmin(userID, object : CompletionHandler {override fun onSuccess() {Log.d("Participant", "User $userID set as admin successfully")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to set admin [Error code: $code]: $desc")}})}// Revoke admin privilegesfun revokeAdmin(userID: String) {participantStore.revokeAdmin(userID, object : CompletionHandler {override fun onSuccess() {Log.d("Participant", "Admin privileges revoked for user $userID")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to revoke admin [Error code: $code]: $desc")}})}
onAdminSet and onAdminRevoked events in RoomParticipantListener to get role change notifications.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onAdminSet(userInfo: RoomUser) {Log.d("Participant", "Admin assigned: $userInfo")}override fun onAdminRevoked(userInfo: RoomUser) {Log.d("Participant", "Admin revoked: $userInfo")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
kickUser on RoomParticipantStore.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)fun kickUser(userID: String) {// Only host/admin can perform this action; the removed user will exit the room and receive a notificationparticipantStore.kickUser(userID, object : CompletionHandler {override fun onSuccess() {Log.d("Participant", "User $userID removed successfully")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to remove user [Error code: $code]: $desc")}})}
onKickedFromRoom event in RoomParticipantListener to handle removal notifications.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.KickedOutOfRoomReasonimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onKickedFromRoom(reason: KickedOutOfRoomReason, message: String) {Log.d("Participant", "Removed from room: $reason, info: $message")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
closeParticipantDevice in RoomParticipantStore to disable a panelist's camera or microphone.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.device.DeviceTypeimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)fun closeParticipantDevice(userID: String, device: DeviceType) {// Only affects panelists; audience members do not have device permissionsparticipantStore.closeParticipantDevice(userID, device, object : CompletionHandler {override fun onSuccess() {Log.d("Participant", "Device closed for user $userID, device: $device")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to close device: [Error code: $code]: $desc")}})}
closeParticipantDevice is only applicable to guests. Audience members do not have audio/video device permissions and are unaffected by this operation.onParticipantDeviceClosed event in RoomParticipantListener to update UI when a device is disabled.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.device.DeviceTypeimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onParticipantDeviceClosed(device: DeviceType, operator: RoomUser) {Log.d("Participant", "Device $device closed by ${operator.userName}")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
disableUserMessage in RoomParticipantStore. Muted users are tracked in messageDisabledUserList.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)fun disableUserMessage(userID: String, disable: Boolean) {// Host/admin can mute/unmute user chat; affected users receive notificationparticipantStore.disableUserMessage(userID, disable, object : CompletionHandler {override fun onSuccess() {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "$action user $userID successfully")}override fun onFailure(code: Int, desc: String) {Log.e("Participant", "Failed to mute user chat: [Error code: $code]: $desc")}})}
messageDisabledUserList is only applicable in conference (Webinar) rooms and maintains the list of individually muted users.onUserMessageDisabled event in RoomParticipantListener to update UI when chat is muted/unmuted.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onUserMessageDisabled(disable: Boolean, operator: RoomUser) {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "Chat $action by ${operator.userName}")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
disableAllDevices in RoomParticipantStore. When enabled, panelists cannot turn these devices on independently.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.device.DeviceTypeimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)fun disableAllDevices(device: DeviceType, disable: Boolean) {// Host/admin can mute/unmute all devices in the room; all members receive notificationsparticipantStore.disableAllDevices(device, disable, object : CompletionHandler {override fun onSuccess() {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "${action} all ${device} successfully")}override fun onFailure(code: Int, desc: String) {val action = if (disable) "Muted" else "Unmuted"Log.e("Participant", "Failed to ${action} all ${device} [Error code: $code]: $desc")}})}
onAllDevicesDisabled event in RoomParticipantListener to receive mute/unmute status updates.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.device.DeviceTypeimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onAllDevicesDisabled(device: DeviceType, disable: Boolean, operator: RoomUser) {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "All ${device} ${action} by ${operator.userName}")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
disableAllMessages in RoomParticipantStore. When enabled, chat is restricted for all participants.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)fun disableAllMessages(disable: Boolean) {// Host/admin can mute/unmute chat for all members; notifications sent to allparticipantStore.disableAllMessages(disable, object : CompletionHandler {override fun onSuccess() {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "$action chat successfully")}override fun onFailure(code: Int, desc: String) {val action = if (disable) "Muted" else "Unmuted"Log.e("Participant", "$action chat failed [Error code: $code]: $desc")}})}
onAllMessagesDisabled event in RoomParticipantListener to update chat mute status.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUserprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onAllMessagesDisabled(disable: Boolean, operator: RoomUser) {val action = if (disable) "Muted" else "Unmuted"Log.d("Participant", "Chat ${action} by ${operator.userName}")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
RoomParticipantListener events. For example, to listen for device requests:import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.DeviceRequestInfoimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private val participantListener = object : RoomParticipantListener() {override fun onDeviceRequestReceived(request: DeviceRequestInfo) {Log.d("Participant", "Device request received: ${request.device}, User: ${request.senderUserID}")}}private fun subscribeParticipantEvents() {participantStore.addRoomParticipantListener(participantListener)}
RoomParticipantState, such as monitoring who is currently speaking:import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomParticipantStoreimport kotlinx.coroutines.CoroutineScopeimport kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.launchprivate val roomID = "webinar_123456"private val participantStore = RoomParticipantStore.create(roomID)private fun subscribeParticipantState() {CoroutineScope(Dispatchers.Main).launch {participantStore.state.speakingUsers.collect { speakingUsers ->Log.d("Participant", "Speaking user list updated. Current count: ${speakingUsers.size}")}}}
Store/Component | Feature Description | API Documentation |
RoomParticipantStore | In-room participant management: set admin / transfer host / get panelist list / remove from room / panelist device control (e.g., close or invite to open microphone, etc.). |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback