tencent cloud

Tencent Real-Time Communication

RoomStore

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-07-29 10:51:44

Introduction

Room management provides complete room lifecycle management, including instant rooms and scheduled rooms. RoomStore provides a comprehensive set of APIs to manage room-related operations.
Note:
Room status updates are delivered through state publisher. Subscribe to it to receive real-time updates about current room and scheduled room list.

Features

Instant Room: Supports creating and joining instant rooms.
Scheduled Room: Supports scheduling rooms, modifying schedules, canceling schedules and other operations.
Room Call: Supports calling users to join rooms, accepting/rejecting calls and other operations.
State Management: Real-time tracking of current room status and scheduled room list.

Subscribable Data

RoomState fields are described below:
Property
Type
Description
scheduledRoomList
StateFlow<List<RoomInfo>>
Scheduled room list.
scheduledRoomListCursor
StateFlow<String>
Scheduled room list cursor.
currentRoom
StateFlow<RoomInfo?>
Current room info.

API List

Function
Description
Get singleton object.
Room event callback.
Room event callback.
Get scheduled room list.
Get scheduled room attendees.
Schedule a room.
Update scheduled room.
Add scheduled attendees.
Remove scheduled attendees.
Cancel scheduled room.
Create and join room.
Join room.
Leave room.
End room.
Update room info.
Get room info.
Get pending calls list.
Call user to join room.
Cancel call.
Accept call.
Reject call.
Start cloud recording.
Stop cloud recording.

Getting Instance

RoomStore.shared

Get singleton object.

Observing State and Events

addRoomListener

Add room event callback listener.
abstract fun addRoomListener(listener: RoomListener?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
listener
Listener.

removeRoomListener

Remove room event callback listener.
abstract fun removeRoomListener(listener: RoomListener?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
listener
Listener.

Scheduled Room Operations

getScheduledRoomList

Get scheduled room list.
abstract fun getScheduledRoomList(cursor: String?, completion: ListResultCompletionHandler<RoomInfo>?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
cursor
String?
Pagination cursor.
completion
ListResultCompletionHandler<RoomInfo>?
Completion callback.

getScheduledAttendees

Get scheduled room attendees.
abstract fun getScheduledAttendees(
roomID: String,
cursor: String?,
completion: ListResultCompletionHandler<RoomUser>?
)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
cursor
String?
Pagination cursor.
completion
ListResultCompletionHandler<RoomUser>?
Completion callback.

scheduleRoom

Schedule a room.
abstract fun scheduleRoom(roomID: String, options: ScheduleRoomOptions, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
options
Schedule options.
completion
CompletionHandler?
Completion callback.

updateScheduledRoom

Update scheduled room.
abstract fun updateScheduledRoom(
roomID: String,
options: ScheduleRoomOptions,
modifyFlagList: List<ScheduleRoomOptions.ModifyFlag>,
completion: CompletionHandler?
)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
options
Schedule options.
modifyFlagList
List<ScheduleRoomOptions.ModifyFlag>
Modify flag.
completion
CompletionHandler?
Completion callback.

addScheduledAttendees

Add scheduled attendees.
abstract fun addScheduledAttendees(roomID: String, userIDList: List<String>, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
userIDList
List<String>
User ID list.
completion
CompletionHandler?
Completion callback.

removeScheduledAttendees

Remove scheduled attendees.
abstract fun removeScheduledAttendees(roomID: String, userIDList: List<String>, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
userIDList
List<String>
User ID list.
completion
CompletionHandler?
Completion callback.

cancelScheduledRoom

Cancel scheduled room.
abstract fun cancelScheduledRoom(roomID: String, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
completion
CompletionHandler?
Completion callback.

Instant Room Operations

createAndJoinRoom

Create and join room.
abstract fun createAndJoinRoom(roomID: String, roomType: RoomType, options: CreateRoomOptions, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
roomType
Room type (standard or webinar).
options
Create options.
completion
CompletionHandler?
Completion callback.

joinRoom

Join room.
abstract fun joinRoom(roomID: String, roomType: RoomType, password: String? = "", completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
roomType
Room type (standard or webinar).
password
String?
Room password.
completion
CompletionHandler?
Completion callback.

leaveRoom

Leave room.
abstract fun leaveRoom(completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
completion
CompletionHandler?
Completion callback.

endRoom

End room.
abstract fun endRoom(completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
completion
CompletionHandler?
Completion callback.

updateRoomInfo

Update room info.
abstract fun updateRoomInfo(
roomID: String,
options: UpdateRoomOptions,
modifyFlagList: List<UpdateRoomOptions.ModifyFlag>,
completion: CompletionHandler?
)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
options
Update options.
modifyFlagList
List<UpdateRoomOptions.ModifyFlag>
Modify flag.
completion
CompletionHandler?
Completion callback.

getRoomInfo

Get room info.
abstract fun getRoomInfo(roomID: String, completion: GetRoomInfoCompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
completion
Completion callback.

Room Call Operations

getPendingCalls

Get pending calls list.
abstract fun getPendingCalls(
roomID: String,
cursor: String?,
completion: ListResultCompletionHandler<RoomCall>?
)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
cursor
String?
Pagination cursor.
completion
ListResultCompletionHandler<RoomCall>?
Completion callback.

callUserToRoom

Call user to join room.
abstract fun callUserToRoom(
roomID: String,
userIDList: List<String>,
timeout: Int = 0,
extensionInfo: String? = null,
completion: CallUserToRoomCompletionHandler?
)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
userIDList
List<String>
User ID list.
timeout
Int
Timeout (in seconds).
extensionInfo
String?
Extension info.
completion
Completion callback.

cancelCall

Cancel call.
abstract fun cancelCall(roomID: String, userIDList: List<String>, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
userIDList
List<String>
User ID list.
completion
CompletionHandler?
Completion callback.

acceptCall

Accept call.
abstract fun acceptCall(roomID: String, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
completion
CompletionHandler?
Completion callback.

rejectCall

Reject call.
abstract fun rejectCall(roomID: String, reason: CallRejectionReason, completion: CompletionHandler?)
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
roomID
String
Room ID.
reason
Rejection reason.
completion
CompletionHandler?
Completion callback.

Recording Operations

startRecording

Start cloud recording.
abstract fun startRecording(options: StartRecordingOptions = StartRecordingOptions(), completion: CompletionHandler?)
Only Owner and Admin have permission to call.
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
options
Recording options, reserved for future extensions.
completion
CompletionHandler?
Completion callback.

stopRecording

Stop cloud recording.
abstract fun stopRecording(completion: CompletionHandler?)
Only Owner and Admin have permission to call.
Version
Supported since version 3.5.
Parameters
Parameter
Type
Description
completion
CompletionHandler?
Completion callback.

Data Structures

RoomType

Room type.
Enum Value
Value
Description
STANDARD
1
Standard room.
WEBINAR
2
Webinar room.

RoomStatus

Room status.
Enum Value
Value
Description
SCHEDULED
1
Scheduled.
RUNNING
2
Running.

RoomCallStatus

Room call status.
Enum Value
Value
Description
NONE
0
No call.
CALLING
1
Calling.
TIMEOUT
2
Call timeout.
REJECTED
3
Call rejected.

RoomCallResult

Call user to room result.
Enum Value
Value
Description
SUCCESS
0
Call success.
ALREADY_IN_CALLING
1
User already in calling.
ALREADY_IN_ROOM
2
User already in room.

CallRejectionReason

Call rejection reason.
Enum Value
Value
Description
REJECTED
0
User actively rejected.
IN_OTHER_ROOM
1
User in another room.

RecordingStatus

Recording status.
Enum Value
Value
Description
NONE
0
Not recording.
RECORDING
1
Recording in progress.

RecordingStopReason

Recording stop reason.
Enum Value
Value
Description
STOPPED_BY_USER
0
Manually stopped by user.
ROOM_DISMISSED
1
Room dismissed.
MAX_DURATION_REACHED
2
Max recording duration reached.
STORAGE_LIMIT_REACHED
3
Storage space limit reached.

RecordingError

Recording related error codes.
Enum Value
Value
Description
NO_ERROR
0
Operation successful.
NO_PERMISSION
1
Caller is not Owner / Admin.
FEATURE_NOT_ENABLED
2
Cloud recording feature not enabled in console.
STORAGE_NOT_CONFIGURED
3
Recording storage (COS / VOD) not configured.
SERVICE_UNAVAILABLE
4
RoomKit / TRTC recording service temporarily unavailable.
UNKNOWN_ERROR
5
Unknown error.

RoomListener

Room event callback.
Methods
Method
Description
onAddedToScheduledRoom
Triggered when added to a scheduled room.
onRemovedFromScheduledRoom
Triggered when removed from a scheduled room.
onScheduledRoomCancelled
Triggered when a scheduled room is cancelled.
onScheduledRoomStartingSoon
Triggered when a scheduled room is about to start.
onRoomEnded
Triggered when a room ends.
onCallReceived
Triggered when a room call is received.
onCallCancelled
Triggered when a room call is cancelled.
onCallTimeout
Triggered when a room call times out.
onCallAccepted
Triggered when a room call is accepted.
onCallRejected
Triggered when a room call is rejected.
onCallHandledByOtherDevice
Triggered when a room call is handled by another device.
onCallRevokedByAdmin
Triggered when a room call is revoked by admin.
onRecordingStarted
Triggered when recording starts.
onRecordingStopped
Triggered when recording stops.

RoomUser

Room user info.
Property
Type
Description
userID
String
User ID.
userName
String
User name.
avatarURL
String
User avatar URL.

RecordingInfo

Recording info.
Property
Type
Description
status
Recording status.
operatorUser
User who started the recording.
startTime
Long
Recording start timestamp.

RoomInfo

Room info.
Property
Type
Description
roomID
String
Room ID.
roomName
String
Room name.
roomOwner
Room owner.
roomType
Room type.
participantCount
Int
Participant count.
audienceCount
Int
Audience count (for webinar room).
createTime
Long
Create time.
roomStatus
Room status.
scheduledStartTime
Long
Scheduled start time.
scheduledEndTime
Long
Scheduled end time.
startReminderInSeconds
Int
Reminder seconds before start.
scheduleAttendees
List<RoomUser>
Scheduled attendees list.
password
String?
Room password.
isAllMicrophoneDisabled
Boolean
Whether all microphones are disabled.
isAllCameraDisabled
Boolean
Whether all cameras are disabled.
isAllMessageDisabled
Boolean
Whether all messages are disabled.
isAllScreenShareDisabled
Boolean
Whether all screen sharing is disabled.
recordingInfo
Recording info.

ScheduleRoomOptions

Schedule room options.
Property
Type
Description
roomName
String
Room name.
password
String
Room password.
scheduleStartTime
Long
Scheduled start time.
scheduleEndTime
Long
Scheduled end time.
reminderSecondsBeforeStart
Int
Reminder seconds before start.
scheduleAttendees
List<String>
Scheduled attendee ID list.
isAllMicrophoneDisabled
Boolean
Whether all microphones are disabled.
isAllCameraDisabled
Boolean
Whether all cameras are disabled.
isAllScreenShareDisabled
Boolean
Whether all screen sharing is disabled.
isAllMessageDisabled
Boolean
Whether all messages are disabled.

CreateRoomOptions

Create room options.
Property
Type
Description
roomName
String
Room name.
password
String
Room password.
isAllMicrophoneDisabled
Boolean
Whether all microphones are disabled.
isAllCameraDisabled
Boolean
Whether all cameras are disabled.
isAllScreenShareDisabled
Boolean
Whether all screen sharing is disabled.
isAllMessageDisabled
Boolean
Whether all messages are disabled.

UpdateRoomOptions

Update room options.
Property
Type
Description
roomName
String
Room name.
password
String
Room password.

StartRecordingOptions

Start recording options.

RoomCall

Room call info.
Property
Type
Description
caller
Caller info.
callee
Callee info.
status
Call status.

RoomState

Room related state data provided by RoomStore.
Property
Type
Description
scheduledRoomList
StateFlow<List<RoomInfo>>
Scheduled room list.
scheduledRoomListCursor
StateFlow<String>
Scheduled room list cursor.
currentRoom
StateFlow<RoomInfo?>
Current room info.

CallUserToRoomCompletionHandler

Call user to room completion callback.
Methods
onSuccess: Success callback.
fun onSuccess(result: Map<String, RoomCallResult>)
Parameter
Type
Description
result
Map<String, RoomCallResult>
Call result map.
onFailure: Failure callback.
fun onFailure(code: Int, desc: String)
Parameter
Type
Description
code
Int
Error code.
desc
String
Error description.

GetRoomInfoCompletionHandler

Get room info completion callback.
Methods
onSuccess: Success callback.
fun onSuccess(roomInfo: RoomInfo)
Parameter
Type
Description
roomInfo
Room info.
onFailure: Failure callback.
fun onFailure(code: Int, desc: String)
Parameter
Type
Description
code
Int
Error code.
desc
String
Error description.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック