RTSRoom class

Inheritance

Constructors

RTSRoom([NativeClassOptions? options])

Properties

$resource → NativeResource
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
ready Future<void>
Whether the instance is initialized
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

destroy() FutureOr<void>
@detail api @brief Leave and destroy the room instance created by calling createRTSRoom{@link #RTCEngine#createRTSRoom}.
override
joinRTSRoom(String token, UserInfo userInfo) FutureOr<int>
@detail api @brief Joins the RTS room.
After creating a room by calling createRTSRoom{@link #RTCEngine#createRTSRoom}, call this API to join the room and make audio & video calls with other users in the room. @param token Dynamic key. It is used for authentication and verification of users entering the room.
You need to bring Token to enter the room. When testing, you can use the console to generate temporary tokens. The official launch requires the use of the key SDK to generate and issue tokens at your server level. See Use Token to complete authentication for token validity and generation method.
Apps with different AppIDs are not interoperable.
Make sure that the AppID used to generate the Token is the same as the AppID used to create the engine, otherwise it will cause the join room to fail. @param userInfo User information. See UserInfo{@link #UserInfo}. @return - 0: Success. - Local users receive notifications of the room state via onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged}. - -1: RoomID/userI nfo.uid contains invalid parameters. - -2: Already in the room. After the interface call is successful, as long as the return value of 0 is received and leaveRoom{@link #RTSRoom#leaveRoom} is not called successfully, this return value is triggered when the room entry interface is called again, regardless of whether the filled room ID and user ID are duplicated. The reason for the failure will be communicated via the onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} callback. @note - In the same room with the same App ID, the user ID of each user must be unique. If two users have the same user ID, the user who entered the room later will kick the user who entered the room out of the room, and the user who entered the room will receive the onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} callback notification. For the error type. See kErrorCodeDuplicateLogin in ERROR_CODE_DUPLICATE_LOGIN{@link #ErrorCode#ERROR_CODE_DUPLICATE_LOGIN}. - After the user successfully joins the room, the SDK may lose connection to the server in case of poor local network conditions. At this point, onConnectionStateChanged{@link #IRTCEngineEventHandler#onConnectionStateChanged} callback will be triggered and the SDK will automatically retry until it successfully reconnects to the server. After successful reconnection, onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} callback notification will be received locally.
leaveRoom() FutureOr<int>
@detail api @brief Leave the RTS room.
The user calls this method to leave the room, end the call process, and release all call-related resources.
@return - 0: Success. If the user is a host: - The other participants receive onUserLeave{@link #IRTSRoomEventHandler#onUserLeave} callback. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details @note - After a user who calls setUserVisibility{@link #RTCRoom#setUserVisibility} to make himself visible leaves the room, other users in the room will receive a callback notification from onUserLeave{@link #IRTSRoomEventHandler#onUserLeave}. - This method is an asynchronous operation, and the call returns without actually exiting the room. After you actually exit the room, you will receive a callback notification from onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} locally. If the engine is destroyed immediately after this method is called, the SDK will not be able to trigger the onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} callback.
nativeCall<T>(String method, [List? args, NativeMethodMeta? meta]) Future<T>
Call instance method
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendInstanceGet<T>(String property) Future<T>
Get instance property
inherited
sendInstancePropertiesGet(dynamic nativeClass) Future<Map<String, dynamic>>
Get instance properties
inherited
sendInstanceSet(String property, dynamic value) Future<void>
Set instance property
inherited
sendRoomBinaryMessage(ArrayBuffer buffer) FutureOr<long>
@detail api @brief Group binary messages to all other users in the room. @param buffer The content of the binary message sent. The message does not exceed 46KB. @note - Before broadcasting binary messages in the room, you must call joinRTSRoom{@link #RTSRoom#joinRTSRoom} to join the room. - After the call, you will receive the onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} callback; - Other users in the same room will receive the onRoomBinaryMessageReceived{@link #IRTSRoomEventHandler#onRoomBinaryMessageReceived} callback.
sendRoomMessage(String messageStr) FutureOr<long>
@detail api @brief Mass text messages to all other users in the room. @param messageStr The content of the text message sent. The message does not exceed 64 KB. @note - Before broadcasting a text message in the room, you must call joinRTSRoom{@link #RTSRoom#joinRTSRoom} to join the room. - After the call, you will receive the onRoomMessageSendResult{@link #IRTSRoomEventHandler#onRoomMessageSendResult} callback; - Other users in the same room will receive the onRoomMessageReceived{@link #IRTSRoomEventHandler#onRoomMessageReceived} callback.
sendUserBinaryMessage(String userId, ArrayBuffer buffer, MessageConfig config) FutureOr<long>
@detail api @brief Sends a point-to-point binary message to the specified user in the room. @param userId Message Receives user ID @param buffer Binary message content sent. Message does not exceed 46KB. @param config See MessageConfig{@link #MessageConfig} @note - Before sending in-room binary messages, you must call joinRTSRoom{@link #RTSRoom#joinRTSRoom} to join the room. - After the call, you will receive an onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} callback to notify that the message was sent successfully or failed; - If the message was sent successfully, the user specified by the userId will receive an onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived} callback.
sendUserMessage(String userId, String messageStr, MessageConfig config) FutureOr<long>
@detail api @brief Send a point-to-point text message to the specified user in the room @param userId User ID of the message receiver @param messageStr Text message content sent. Message does not exceed 64 KB. @param config See MessageConfig{@link #MessageConfig}. @return - > 0: Sent successfully, return the number of the sent message, increment from 1 - -1: Sent failed, RTCRoom instance not created - -2: Sent failed, uid is empty @note - Before sending an in-room text message, you must call joinRTSRoom{@link #RTSRoom#joinRTSRoom} to join the room. - After the call, you will receive an onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} callback to notify that the message was sent successfully or failed; - If the message was sent successfully, the user specified by the userId will receive an onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived} callback.
setRTSRoomEventHandler(IRTSRoomEventHandler rtcRoomEventHandler) FutureOr<int>
@detail api @brief Listens for event callbacks related to the RTCRoom{@link #RTCRoom} instance by setting the event handler of this instance. @param rtcRoomEventHandler Refer to IRTSRoomEventHandler{@link #IRTSRoomEventHandler}. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
toString() String
A string representation of this object.
inherited
updateResource(NativeResource resource) → void
inherited
updateToken(String token) FutureOr<int>
@detail api @brief Updates the room token.
You must call this API to update token to ensure the RTC call to continue when you receive onTokenWillExpire{@link #IRTCRoomEventHandler#onTokenWillExpire}, onPublishPrivilegeTokenWillExpire{@link #IRTCRoomEventHandler#onPublishPrivilegeTokenWillExpire}, or {@link #IRTCRoomEventHandler#onSubscribePrivilegeTokenWillExpire}. @param token Valid token.
If the Token is invalid, you will receive onRoomStateChanged{@link #IRTSRoomEventHandler#onRoomStateChanged} with the error code of -1010. @return API call result:
- 0: Success. - <0: Failure. See ReturnStatus{@link #ReturnStatus} for specific reasons. @note - Do not call both updateToken{@link #RTSRoom#updateToken} and joinRTSRoom{@link #RTSRoom#joinRTSRoom} to update the Token. If you fail to join the room or have been removed from the room due to an expired or invalid Token, call joinRTSRoom{@link #RTSRoom#joinRTSRoom} with a valid token to rejoin the room.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

codegen_$namespace → dynamic
no setter