RoomStore are summarized in the table below:Core Concept | Type | Core Responsibility & Description |
enum class | Indicates the status of an in-meeting call: NONE (default)CALLING (call in progress)TIMEOUT (call timed out)REJECTED (call rejected) | |
enum class | Represents the result of an in-meeting call: SUCCESS (call succeeded)ALREADY_IN_CALLING (already in a call)ALREADY_IN_ROOM (already in the room) | |
enum class | Specifies the reason for call rejection: REJECTED (actively rejected when invited)IN_OTHER_ROOM (user is in another room) | |
data class | Core data structure for in-meeting call operations. Stores caller info, callee info, and current call status. | |
abstract class | Handles real-time events for room activity, including in-meeting call events. | |
abstract class | Manages the complete room lifecycle. Provides APIs to initiate and respond to in-meeting calls, fetch call lists, and subscribe to RoomListener for real-time call events. |
callUserToRoom in RoomStore to invite multiple users to join a room simultaneously.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.CallUserToRoomCompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomCallResultimport io.trtc.tuikit.atomicxcore.api.room.RoomStoreprivate val roomID = "test_room_001"// Invite users to join the roomfun callUserToRoom(userIDList: List<String>, timeout: Int = 30, extensionInfo: String? = null) {RoomStore.shared().callUserToRoom(roomID, userIDList, timeout, extensionInfo, object : CallUserToRoomCompletionHandler {override fun onSuccess(result: Map<String, RoomCallResult>) {Log.d("Room", "Call request sent successfully")}override fun onFailure(code: Int, desc: String) {Log.d("Room", "Failed to call users: [Error code: $code]: $desc")}})}
cancelCall to revoke ongoing call requests in bulk.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomStoreprivate val roomID = "test_room_001"// Cancel call requestsfun cancelCall(userIDList: List<String>) {RoomStore.shared().cancelCall(roomID, userIDList, object : CompletionHandler {override fun onSuccess() {Log.d("Room", "Call cancelled successfully")}override fun onFailure(code: Int, desc: String) {Log.d("Room", "Failed to cancel call: [Error code: $code]: $desc")}})}
getPendingCalls to retrieve a paginated list of users currently being called.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.ListResultCompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.RoomCallimport io.trtc.tuikit.atomicxcore.api.room.RoomStoreprivate val roomID = "test_room_001"// Fetch pending call listfun getPendingCalls(roomID: String, cursor: String?) {RoomStore.shared().getPendingCalls(roomID, cursor, object : ListResultCompletionHandler<RoomCall> {override fun onSuccess(result: List<RoomCall>, cursor: String) {Log.d("Room", "Call list retrieved: $result, pagination cursor: $cursor")}override fun onFailure(code: Int, desc: String) {Log.d("Room", "Failed to retrieve call list: [Error code: $code]: $desc")}})}
import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.CallRejectionReasonimport io.trtc.tuikit.atomicxcore.api.room.RoomCallimport io.trtc.tuikit.atomicxcore.api.room.RoomInfoimport io.trtc.tuikit.atomicxcore.api.room.RoomListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomStore// Subscribe to call-related eventsfun subscribeRoomCallEvents() {RoomStore.shared().addRoomListener(object : RoomListener() {override fun onCallTimeout(roomInfo: RoomInfo, call: RoomCall) {Log.d("Room", "Call timed out. Room info: $roomInfo, Caller: ${call.caller}")}override fun onCallAccepted(roomInfo: RoomInfo, call: RoomCall) {Log.d("Room", "Call accepted. Room info: $roomInfo, Callee: ${call.callee}")}override fun onCallRejected(roomInfo: RoomInfo, call: RoomCall, reason: CallRejectionReason) {Log.d("Room", "Call rejected. Room info: $roomInfo, Callee: ${call.callee}, Reason: $reason")}override fun onCallHandledByOtherDevice(roomInfo: RoomInfo, isAccepted: Boolean) {Log.d("Room", "Call handled on another device. Room info: $roomInfo, Result: $isAccepted")}})}
Event Function | Trigger Timing & Description |
Triggered when the call request receives no response from the callee within the specified timeout period (set in callUserToRoom). The call ends automatically, and callers should display a "No answer" prompt. | |
Triggered when the callee clicks "Answer" or "Accept". Both sides have agreed to the call; the caller should enter the room or start streaming immediately. | |
Triggered when the callee rejects the call request, or if the callee is in another room. The callback includes the rejection reason (active rejection or in another room). | |
Triggered if the user is logged in on multiple devices and the call is handled (accepted/rejected) on one device. The other device receives this event to synchronize UI and dismiss the call interface. |
import android.util.Logimport io.trtc.tuikit.atomicxcore.api.room.RoomCallimport io.trtc.tuikit.atomicxcore.api.room.RoomInfoimport io.trtc.tuikit.atomicxcore.api.room.RoomListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomStoreimport io.trtc.tuikit.atomicxcore.api.room.RoomUser// Subscribe to call-related eventsfun subscribeRoomCallEvents() {RoomStore.shared().addRoomListener(object : RoomListener() {override fun onCallReceived(roomInfo: RoomInfo, call: RoomCall, extensionInfo: String) {Log.d("Room", "Received call. Room info: $roomInfo, Caller: ${call.caller}, Extension info: $extensionInfo")}override fun onCallCancelled(roomInfo: RoomInfo, call: RoomCall) {Log.d("Room", "Call cancelled. Room info: $roomInfo, Caller: ${call.caller}")}override fun onCallRevokedByAdmin(roomInfo: RoomInfo, call: RoomCall, operator: RoomUser) {Log.d("Room", "Call revoked by admin. Room info: $roomInfo, Caller: ${call.caller}, Operator: $operator")}})}
Event Function | Trigger Timing & Description |
Triggered when you receive a call invitation. Display a "Call Notification" UI with caller and room details, along with "Accept" and "Reject" options. | |
Triggered when the caller cancels the call request before you respond. Close the call notification UI and show "The caller has cancelled the call" to restore normal flow. | |
Triggered when a room admin or backend system forcibly terminates the call (due to permissions, room dissolution, etc). Immediately stop the call process and hide related UI, similar to call cancellation handling. |
acceptCall or rejectCall in RoomStore to respond to call invitations.import android.util.Logimport io.trtc.tuikit.atomicxcore.api.CompletionHandlerimport io.trtc.tuikit.atomicxcore.api.room.CallRejectionReasonimport io.trtc.tuikit.atomicxcore.api.room.RoomCallimport io.trtc.tuikit.atomicxcore.api.room.RoomInfoimport io.trtc.tuikit.atomicxcore.api.room.RoomListenerimport io.trtc.tuikit.atomicxcore.api.room.RoomStore// Subscribe to call-related eventsfun subscribeRoomCallEvents() {RoomStore.shared().addRoomListener(object : RoomListener() {override fun onCallReceived(roomInfo: RoomInfo, call: RoomCall, extensionInfo: String) {Log.d("Room", "Received call. Room info: $roomInfo, Caller: ${call.caller}, Extension info: $extensionInfo")// Handle accept or reject operation here}})}// Accept call invitationfun acceptCall(roomID: String) {RoomStore.shared().acceptCall(roomID, object : CompletionHandler {override fun onSuccess() {Log.d("Room", "Call accepted successfully, Room ID: $roomID")}override fun onFailure(code: Int, desc: String) {Log.d("Room", "Failed to accept call: [Error code: $code] $desc")}})}// Reject call invitationfun rejectCall(roomID: String, reason: CallRejectionReason = CallRejectionReason.REJECTED) {RoomStore.shared().rejectCall(roomID, reason, object : CompletionHandler {override fun onSuccess() {Log.d("Room", "Call rejected successfully, Room ID: $roomID")}override fun onFailure(code: Int, desc: String) {Log.d("Room", "Failed to reject call: [Error code: $code] $desc")}})}
Store/Component | Description | API Documentation |
RoomStore | Manages the full room lifecycle: create and join, join, leave, end room, update/retrieve room information, schedule rooms, invite external members, listen for passive room events (such as room dissolution, room info updates, etc). |
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários