enterRoom method

Future<TUIValueCallBack<TUIRoomInfo>> enterRoom(
  1. String roomId,
  2. bool enableMic,
  3. bool enableCamera,
  4. bool isSoundOnSpeaker,
)

Implementation

Future<TUIValueCallBack<TUIRoomInfo>> enterRoom(String roomId, bool enableMic,
    bool enableCamera, bool isSoundOnSpeaker) async {
  _setFramework();
  TUIValueCallBack<TUIRoomInfo> result = await _roomEngine.enterRoom(roomId);
  if (result.code == TUIError.success) {
    RoomStore.to.roomInfo = result.data!;
    RoomStore.to.isEnteredRoom = true;
    RoomStore.to.timeStampOnEnterRoom = DateTime.now().millisecondsSinceEpoch;
    await _getUserList();
    await RoomStore.to.initialCurrentUser();
    bool isTakeSeatSuccess = await _autoTakeSeatForOwner();
    if (!isTakeSeatSuccess) {
      result.code = TUIError.errUserNotInSeat;
    }
    RoomStore.to.initItemTouchableState();
    _decideMediaStatus(enableMic, enableCamera, isSoundOnSpeaker);
    if (GetPlatform.isAndroid) {
      RtcConferenceTuikitPlatform.instance.startForegroundService();
    }
  }
  return result;
}