createRoom static method
- required String roomId,
- required String token,
- String? participantName,
- bool micEnabled = true,
- bool camEnabled = true,
- String? participantId,
- MaxResolution? maxResolution,
- FacingMode defaultCamera = FacingMode.FRONT,
- bool? multiStream,
- CustomStreamTrack? customCameraTrack,
- CustomStreamTrack? customMicrophoneTrack,
- Mode? mode,
- Map<
String, dynamic> ? metaData, - String? signalingBaseUrl,
- PreferredProtocol? preferredProtocol,
- String? translationLanguage,
- String? speakingLanguage,
- bool autoConsume = true,
- bool codecSwitchEnabled = true,
- bool enableBatching = true,
- bool dynaCast = false,
Creates a room.
The returned Room is not connected yet — attach handlers with
room.on(...), then call room.join(). Pre-join calls such as
Room.setVideoProcessor apply to it directly.
One Room at a time: a new createRoom releases the previous Room, and
leaves its room if it had joined. A Room whose join failed releases
itself.
Parameters
roomId— the room to join.token— an auth token generated by your server.participantName— the name other participants see. Leave it out and the SDK picks a random one.micEnabled,camEnabled— whether the microphone and camera are on when you join. Both default totrue.participantId— your own id for the local participant. Leave it out and the SDK generates one.customCameraTrack,customMicrophoneTrack— tracks from createCameraVideoTrack and createMicrophoneAudioTrack to join with, so the room starts with the settings the user previewed.multiStream— publish several video qualities (simulcast) so each receiver gets one that suits its network and tile size. Leave it out for the SDK default.mode— whether the local participant sends and receives media, receives only, or does neither. Leave it out for the SDK default.metaData— any data to attach to the local participant; others read it as Participant.metaData.preferredProtocol— the transport for media. See PreferredProtocol.signalingBaseUrl— a custom signaling server. Leave it out to use VideoSDK's.translationLanguage— the language to translate into when translation runs.speakingLanguage— the language the local participant speaks, for transcription and translation.codecSwitchEnabled— when a participant cannot decode the current video codec, switch the room to VP8 so everyone can see each other. See Events.codecChanged. Defaults totrue.enableBatching— whether the SDK batches room events. Defaults totrue.maxResolution— the highest resolution the room works at. MaxResolution.SD opens the default webcam at 960x540 instead of 1280x720 and makes Participant.setQuality ask for one simulcast layer lower. AcustomCameraTrackkeeps its own encoder config. Leave it out for the SDK default.defaultCamera— the camera the default webcam opens on. AcustomCameraTrackkeeps its own facing mode, and afterroom.changeCam()the webcam stays on the camera switched to. Defaults to FacingMode.FRONT.autoConsume— withfalse, no remote stream arrives until Participant.consumeMicStreams / Participant.consumeWebcamStreams asks for it, which saves bandwidth in large rooms. Defaults totrue.dynaCast— withtrue, the server lowers the quality of the webcam video you send while no one is watching its larger layers, and raises it again when someone is. No effect withmultiStreamoff. Defaults tofalse.
Example
final room = VideoSDK.createRoom(
roomId: 'abcd-efgh-ijkl',
token: token,
participantName: 'Alice',
);
Implementation
static Room createRoom({
required String roomId,
required String token,
String? participantName,
bool micEnabled = true,
bool camEnabled = true,
String? participantId,
MaxResolution? maxResolution,
FacingMode defaultCamera = FacingMode.FRONT,
bool? multiStream,
CustomStreamTrack? customCameraTrack,
CustomStreamTrack? customMicrophoneTrack,
Mode? mode,
Map<String, dynamic>? metaData,
String? signalingBaseUrl,
PreferredProtocol? preferredProtocol,
String? translationLanguage,
String? speakingLanguage,
bool autoConsume = true,
bool codecSwitchEnabled = true,
bool enableBatching = true,
bool dynaCast = false,
}) {
return Room(
roomId: roomId,
token: token,
participantId: participantId,
participantName: participantName,
micEnabled: micEnabled,
camEnabled: camEnabled,
maxResolution: maxResolution,
multiStream: multiStream,
customCameraTrack: customCameraTrack,
customMicrophoneTrack: customMicrophoneTrack,
mode: mode,
metaData: metaData,
defaultCamera: defaultCamera,
signalingBaseUrl: signalingBaseUrl,
preferredProtocol: preferredProtocol,
translationLanguage: translationLanguage,
speakingLanguage: speakingLanguage,
autoConsume: autoConsume,
codecSwitchEnabled: codecSwitchEnabled,
enableBatching: enableBatching,
dynaCast: dynaCast,
);
}