帮你快速理解、总结文档立即下载

RoomParticipantStore

最近更新时间:2026-07-20 15:11:01

我的收藏

简介

房间参与者管理功能提供了完整的参与者生命周期管理,包括权限管理、设备控制、消息禁言等功能。RoomParticipantStore 提供了一套全面的 API 来管理房间参与者相关操作。
说明:
参与者状态更新通过 state 发布者传递。订阅它以接收有关参与者列表的实时更新。

功能特性

权限管理:支持转让房主、设置/撤销管理员、踢出用户等操作。
设备控制:支持关闭参与者设备、禁用所有设备等操作。
消息禁言:支持禁言单个用户或全员禁言。
设备请求/邀请:支持请求开启设备、邀请开启设备等双向交互。

可订阅数据

RoomParticipantState 的字段描述如下:
属性名
类型
描述
participantList
StateFlow<List<RoomParticipant>>
参与者列表。
participantListCursor
StateFlow<String>
参与者列表游标。
audienceList
StateFlow<List<RoomUser>>
观众列表(适用于网络研讨会模式)。
audienceListCursor
StateFlow<String>
观众列表游标。
adminList
StateFlow<List<RoomUser>>
管理员列表。
messageDisabledUserList
StateFlow<List<RoomUser>>
被禁言用户列表。
participantListWithVideo
StateFlow<List<RoomParticipant>>
有视频的参与者列表。
participantWithScreen
StateFlow<RoomParticipant?>
正在屏幕共享的参与者。
pendingDeviceApplications
StateFlow<List<DeviceRequestInfo>>
待处理的设备申请列表。
pendingDeviceInvitations
StateFlow<List<DeviceRequestInfo>>
待处理的设备邀请列表。
speakingUsers
StateFlow<MutableMap<String, Int>>
正在说话的用户及其音量。
networkQualities
StateFlow<MutableMap<String, NetworkInfo>>
用户网络质量信息。
pendingParticipantList
StateFlow<List<RoomParticipant>>
待加入的参与者列表。
localParticipant
StateFlow<RoomParticipant?>
本地参与者信息。

API 列表

函数名
描述
创建对象实例。
参与者事件回调。
参与者事件回调。
获取参与者列表。
获取观众列表(适用于网络研讨会模式)。
根据关键字搜索用户。
将观众提升为嘉宾(适用于网络研讨会模式)。
将嘉宾降级为观众(适用于网络研讨会模式)。
转让房主。
设置管理员。
撤销管理员。
踢出用户。
更新参与者名片。
更新参与者元数据。
静音麦克风。
取消静音麦克风。
关闭参与者设备。
禁言用户。
禁用所有设备。
全员禁言。
请求开启设备。
取消开启设备请求。
批准开启设备请求。
拒绝开启设备请求。
邀请开启设备。
取消开启设备邀请。
接受开启设备邀请。
拒绝开启设备邀请。

创建实例

RoomParticipantStore.create

创建对象实例。

观察状态和事件

addRoomParticipantListener

添加参与者事件回调监听器。
abstract fun addRoomParticipantListener(listener: RoomParticipantListener?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
listener
监听器。

removeRoomParticipantListener

移除参与者事件回调监听器。
abstract fun removeRoomParticipantListener(listener: RoomParticipantListener?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
listener
监听器。

参与者列表

getParticipantList

获取参与者列表。
abstract fun getParticipantList(cursor: String?, completion: ListResultCompletionHandler<RoomParticipant>?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
cursor
String?
分页游标。
completion
ListResultCompletionHandler<RoomParticipant>?
完成回调。

getAudienceList

获取观众列表(适用于网络研讨会模式)。
abstract fun getAudienceList(cursor: String?, completion: ListResultCompletionHandler<RoomUser>?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
cursor
String?
分页游标。
completion
ListResultCompletionHandler<RoomUser>?
完成回调。

searchUsers

根据关键字搜索用户。
abstract fun searchUsers(keyword: String, completion: ListResultCompletionHandler<RoomUser>?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
keyword
String
搜索关键字。
completion
ListResultCompletionHandler<RoomUser>?
完成回调。

观众/嘉宾角色管理

promoteAudienceToParticipant

将观众提升为嘉宾(适用于网络研讨会模式)。
abstract fun promoteAudienceToParticipant(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

demoteParticipantToAudience

将嘉宾降级为观众(适用于网络研讨会模式)。
abstract fun demoteParticipantToAudience(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

权限管理

transferOwner

转让房主。
abstract fun transferOwner(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

setAdmin

设置管理员。
abstract fun setAdmin(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

revokeAdmin

撤销管理员。
abstract fun revokeAdmin(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

kickUser

踢出用户。
abstract fun kickUser(userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

updateParticipantNameCard

更新参与者名片。
abstract fun updateParticipantNameCard(userID: String, nameCard: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
nameCard
String
名片。
completion
CompletionHandler?
完成回调。

updateParticipantMetaData

更新参与者元数据。
abstract fun updateParticipantMetaData(
userID: String,
metaData: HashMap<String, String>,
completion: CompletionHandler?
)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
metaData
HashMap<String, String>
元数据。
completion
CompletionHandler?
完成回调。

本地麦克风控制

muteMicrophone

静音麦克风。
abstract fun muteMicrophone()
版本信息
从3.5版本开始支持。

unmuteMicrophone

取消静音麦克风。
abstract fun unmuteMicrophone(completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
completion
CompletionHandler?
完成回调。

设备控制

closeParticipantDevice

关闭参与者设备。
abstract fun closeParticipantDevice(userID: String, device: DeviceType, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
device
DeviceType
设备类型。
completion
CompletionHandler?
完成回调。

disableUserMessage

禁言用户。
abstract fun disableUserMessage(userID: String, disable: Boolean, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
disable
Boolean
是否禁言。
completion
CompletionHandler?
完成回调。

disableAllDevices

禁用所有设备。
abstract fun disableAllDevices(device: DeviceType, disable: Boolean, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
device
DeviceType
设备类型。
disable
Boolean
是否禁用。
completion
CompletionHandler?
完成回调。

disableAllMessages

全员禁言。
abstract fun disableAllMessages(disable: Boolean, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
disable
Boolean
是否禁言。
completion
CompletionHandler?
完成回调。

设备请求操作

requestToOpenDevice

请求开启设备。
abstract fun requestToOpenDevice(device: DeviceType, timeout: Int = 0, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
device
DeviceType
设备类型。
timeout
Int
超时时间(单位:秒)。
completion
CompletionHandler?
完成回调。

cancelOpenDeviceRequest

取消开启设备请求。
abstract fun cancelOpenDeviceRequest(device: DeviceType, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
device
DeviceType
设备类型。
completion
CompletionHandler?
完成回调。

approveOpenDeviceRequest

批准开启设备请求。
abstract fun approveOpenDeviceRequest(device: DeviceType, userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
device
DeviceType
设备类型。
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

rejectOpenDeviceRequest

拒绝开启设备请求。
abstract fun rejectOpenDeviceRequest(device: DeviceType, userID: String, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
device
DeviceType
设备类型。
userID
String
用户 ID。
completion
CompletionHandler?
完成回调。

设备邀请操作

inviteToOpenDevice

邀请开启设备。
abstract fun inviteToOpenDevice(
userID: String,
device: DeviceType,
timeout: Int = 0,
completion: CompletionHandler?
)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
device
DeviceType
设备类型。
timeout
Int
超时时间(单位:秒)。
completion
CompletionHandler?
完成回调。

cancelOpenDeviceInvitation

取消开启设备邀请。
abstract fun cancelOpenDeviceInvitation(userID: String, device: DeviceType, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
device
DeviceType
设备类型。
completion
CompletionHandler?
完成回调。

acceptOpenDeviceInvitation

接受开启设备邀请。
abstract fun acceptOpenDeviceInvitation(userID: String, device: DeviceType, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
device
DeviceType
设备类型。
completion
CompletionHandler?
完成回调。

declineOpenDeviceInvitation

拒绝开启设备邀请。
abstract fun declineOpenDeviceInvitation(userID: String, device: DeviceType, completion: CompletionHandler?)
版本信息
从3.5版本开始支持。
参数说明
参数名
类型
描述
userID
String
用户 ID。
device
DeviceType
设备类型。
completion
CompletionHandler?
完成回调。

数据结构

ParticipantRole

参与者角色。
枚举值
说明
OWNER
0
房主。
ADMIN
1
管理员。
GENERAL_USER
2
普通用户。

RoomParticipantStatus

参与者状态。
枚举值
说明
scheduled
已预约。
inCalling
呼叫中。
callTimeout
呼叫超时。
callRejected
呼叫被拒绝。
inRoom
在房间中。

KickedOutOfRoomReason

被踢出房间的原因。
枚举值
说明
kickedByAdmin
被管理员踢出。
replacedByAnotherDevice
被其他设备顶替。
kickedByServer
被服务器踢出。
connectionTimeout
连接超时。
invalidStatusOnReconnect
重连时状态无效。
roomLimitExceeded
房间人数超限。

RoomParticipantListener

参与者事件回调。
方法
方法名
说明
onParticipantJoined
当参与者加入房间时触发此回调。
onParticipantLeft
当参与者离开房间时触发此回调。
onAudiencePromotedToParticipant
当观众被提升为嘉宾时触发此回调。
onParticipantDemotedToAudience
当嘉宾被降级为观众时触发此回调。
onOwnerChanged
当房主变更时触发此回调。
onAdminSet
当设置管理员时触发此回调。
onAdminRevoked
当撤销管理员时触发此回调。
onKickedFromRoom
当被踢出房间时触发此回调。
onParticipantDeviceClosed
当参与者设备被关闭时触发此回调。
onUserMessageDisabled
当用户被禁言时触发此回调。
onAllDevicesDisabled
当所有设备被禁用时触发此回调。
onAllMessagesDisabled
当全员禁言时触发此回调。
onDeviceRequestReceived
当收到设备请求时触发此回调。
onDeviceRequestCancelled
当设备请求被取消时触发此回调。
onDeviceRequestTimeout
当设备请求超时时触发此回调。
onDeviceRequestApproved
当设备请求被批准时触发此回调。
onDeviceRequestRejected
当设备请求被拒绝时触发此回调。
onDeviceRequestProcessed
当设备请求被处理时触发此回调。
onDeviceInvitationReceived
当收到设备邀请时触发此回调。
onDeviceInvitationCancelled
当设备邀请被取消时触发此回调。
onDeviceInvitationTimeout
当设备邀请超时时触发此回调。
onDeviceInvitationAccepted
当设备邀请被接受时触发此回调。
onDeviceInvitationDeclined
当设备邀请被拒绝时触发此回调。

RoomParticipant

房间参与者信息。

DeviceRequestInfo

设备请求信息。

RoomParticipantState

RoomParticipantStore 对外提供的参与者相关状态数据。
属性
类型
说明
participantList
StateFlow<List<RoomParticipant>>
参与者列表。
participantListCursor
StateFlow<String>
参与者列表游标。
audienceList
StateFlow<List<RoomUser>>
观众列表(适用于网络研讨会模式)。
audienceListCursor
StateFlow<String>
观众列表游标。
adminList
StateFlow<List<RoomUser>>
管理员列表。
messageDisabledUserList
StateFlow<List<RoomUser>>
被禁言用户列表。
participantListWithVideo
StateFlow<List<RoomParticipant>>
有视频的参与者列表。
participantWithScreen
StateFlow<RoomParticipant?>
正在屏幕共享的参与者。
pendingDeviceApplications
StateFlow<List<DeviceRequestInfo>>
待处理的设备申请列表。
pendingDeviceInvitations
StateFlow<List<DeviceRequestInfo>>
待处理的设备邀请列表。
speakingUsers
StateFlow<MutableMap<String, Int>>
正在说话的用户及其音量。
networkQualities
StateFlow<MutableMap<String, NetworkInfo>>
用户网络质量信息。
pendingParticipantList
StateFlow<List<RoomParticipant>>
待加入的参与者列表。
localParticipant
StateFlow<RoomParticipant?>
本地参与者信息。