createRoom static method

Room createRoom({
  1. required String roomId,
  2. required String displayName,
  3. required String token,
  4. bool micEnabled = true,
  5. bool camEnabled = true,
  6. String participantId = '',
  7. String maxResolution = 'sd',
  8. int defaultCameraIndex = 0,
  9. bool multiStream = true,
  10. CustomTrack? customCameraVideoTrack,
  11. CustomTrack? customMicrophoneAudioTrack,
  12. NotificationInfo notification = const NotificationInfo(title: "Video SDK", message: "Video SDK is sharing screen in the meeting", icon: "notification_share"),
  13. Mode mode = Mode.CONFERENCE,
  14. Map<String, dynamic> metaData = const {},
})

Implementation

static Room createRoom({
  required String roomId,
  required String displayName,
  required String token,
  bool micEnabled = true,
  bool camEnabled = true,
  String participantId = '',
  String maxResolution = 'sd',
  int defaultCameraIndex = 0,
  bool multiStream = true,
  CustomTrack? customCameraVideoTrack,
  CustomTrack? customMicrophoneAudioTrack,
  NotificationInfo notification = const NotificationInfo(
    title: "Video SDK",
    message: "Video SDK is sharing screen in the meeting",
    icon: "notification_share",
  ),
  Mode mode = Mode.CONFERENCE,
  Map<String,dynamic> metaData = const {}
}) {
  //
  participantId = participantId.isNotEmpty ? participantId : randomAlpha(8);

  //
  if (token.isEmpty) {
    //
    //
    // VideoSDKLog.createLog(
    //     message: "Token is empty or invalid.",
    //     logLevel: "ERROR");
    //
    throw "Token is empty or invalid.";
  }

  Room room = Room(
      participantId: participantId,
      displayName: displayName,
      maxResolution: maxResolution,
      camEnabled: camEnabled,
      micEnabled: micEnabled,
      meetingId: roomId,
      multiStream: multiStream,
      token: token,
      notification: notification,
      defaultCameraIndex: defaultCameraIndex,
      customCameraVideoTrack: customCameraVideoTrack,
      customMicrophoneAudioTrack: customMicrophoneAudioTrack,
      mode: mode,
      metaData: metaData);

  if (!kIsWeb) {
    if (!Platform.isMacOS && !Platform.isWindows) {
      _eventChannel.receiveBroadcastStream().listen((event) {
        if (event == "STOP_SCREENSHARE") {
          room.disableScreenShare();
        } else if (event == "START_SCREENSHARE") {
          room.enableShare(null, iosPermissionGiven: true);
        }
      });
    }
  }

  //
  return room;
}