joinRTSRoom method
@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.
Implementation
Future<int?> joinRTSRoom(string token, UserInfo userInfo) async {
$a() => ($instance as $p_a.RTCRoom)
.joinRTSRoom(token, unpackObject<$p_a.UserInfo>(userInfo));
$i() => ($instance as $p_i.ByteRTCRoom)
.joinRTSRoom(token, unpackObject<$p_i.ByteRTCUserInfo>(userInfo));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}