start method

Future<TUIValueCallBack<TUIRoomInfo>> start()

Implementation

Future<TUIValueCallBack<TUIRoomInfo>> start() async {
  _dataReport();
  if (roomState.roomId.isEmpty) {
    LiveKitLogger.error('$tag not init create room state');
    return TUIValueCallBack(code: TUIError.errFailed, message: 'not init create room state');
  }

  roomState.roomName.value = getDefaultRoomName();
  viewState.liveStatus.value = LiveStatus.pushing;

  final roomInfo = TUIRoomInfo(roomId: roomState.roomId);
  roomInfo.roomType = TUIRoomType.livingRoom;
  roomInfo.isSeatEnabled = true;
  roomInfo.name = roomState.roomName.value;
  roomInfo.maxSeatCount = roomState.maxSeatCount.value;
  roomInfo.seatMode = roomState.seatMode.value;
  viewState.liveStatus.value = LiveStatus.pushing;
  final result = await liveService.start(roomInfo);
  if (result.code == TUIError.success) {
    updateRoomState(result.data);
    updateLiveInfo();
  } else {
    ErrorHandler.onError(result.code);
    viewState.liveStatus.value = LiveStatus.none;
  }
  return result;
}