joinRTSRoom method
@detail api
@brief Joins an RTS room.
After creating a room by calling createRTSRoom:{@link #ByteRTCEngine#createRTSRoom}, call this API to join the room and make audio & video calls with other users in the room.
@param token Dynamic key 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 Authentication with Token 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 ByteRTCUserInfo{@link #ByteRTCUserInfo}.
@return Method call result.
- 0: Success.
- Local users receive notifications of the room state via rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo}.
- -1: Invalid parameter
- -2: Already in the room. After the interface call is successful, as long as the return value of 0 is received and leaveRoom{@link #ByteRTCRoom#leaveRoom} is not called successfully, this return value will be 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 rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} callback.
@note
- In the same room with the same AppID, the user ID of each user must be unique. If two users have the same user ID, the user who joined the room later will kick the user who joined the room first out of the room, and the user who joined the room first will receive rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} callback notification, the error type is duplicate login ByteRTCErrorCodeDuplicateLogin.
- Local users will receive rtsRoom:onRoomStateChanged:withUid:state:extraInfo:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onRoomStateChanged:withUid:state:extraInfo} callback notification after calling this method to join the room successfully. If the local user is also a visible user, the remote user will receive an rtsRoom:onUserJoined:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserJoined} callback notification when joining the room.
- After the user successfully joins the room, the SDK may lose connection to the server in case of poor local network conditions. At this time rtcEngine:onConnectionStateChanged:{@link #ByteRTCEngineDelegate#rtcEngine:onConnectionStateChanged} callback will be triggered and the SDK will automatically retry until it successfully reconnects to the server. After successful reconnection, you will receive a callback notification from rtsRoom:onUserJoined:{@link #ByteRTCRTSRoomDelegate#rtsRoom:onUserJoined} locally.
Implementation
FutureOr<int> joinRTSRoom(NSString token, ByteRTCUserInfo userInfo) async {
return await nativeCall('joinRTSRoom:userInfo:', [token, userInfo]);
}