VideoSDK Class Methods - Flutter
createRoom()​
- This method is provided by SDK to build instance of
VideoSDK Room
based on given configuration.
Parameters​
-
roomId
- type:
String
REQUIRED
- Id of the Room to be created.
- type:
-
token
- type:
String
REQUIRED
- Sets AuthToken, which is used for authentication purposes.
- type:
-
displayName
- type:
String
REQUIRED
- Sets name of the LocalParticipant to be displayed.
- type:
-
notification
- type: [
NotificationInfo
] OPTIONAL
- Sets configuration for the notification, that will be shown, while screen-sharing.
- type: [
-
micEnabled
- type:
bool
OPTIONAL
- Whether
mic
of the participant will beon
, while joining the room. If it is set tofalse
, then mic of that participant will bedisabled
by default, but can beenabled
ordisabled
later. - Default value of
micEnabled
is true.
- type:
-
camEnabled
- type:
bool
OPTIONAL
- Whether
camera
of the participant will beon
, while joining the room. If it is set tofalse
, then camera of that participant will bedisabled
by default, but can beenabled
ordisabled
- Default value of
camEnabled
is true.
- type:
-
multiStream
- type:
bool
OPTIONAL
- Default value is
true
. - It will specify if the stream should send multiple resolution layers or single resolution.
- type:
-
participantId
- type:
String
OPTIONAL
- Unique Id of the participant. If not passed then SDK will create an Id by itself and will use that id.
- type:
-
maxResolution
- type:
String
OPTIONAL
- Sets the maximum upload resolution of that participant's camera video stream.
- type:
-
defaultCameraIndex
- type:
int
OPTIONAL
- Sets camera, which will be used by default, while joining the VideoSDK Room. Index of
MediaDevices
will be used to set default camera. You can also change camera later. - Default value of
defaultCameraIndex
is0
.
- type:
-
customCameraVideoTrack
- type:
CustomTrack
OPTIONAL
- Set the initial custom video track using different encoding parameters, camera facing mode, and optimization mode.
- type:
-
customMicrophoneAudioTrack
- type:
CustomTrack
OPTIONAL
- Set the initial custom audio track using different encoding parameters and optimization mode.
- type:
-
mode
- type:
Mode
OPTIONAL
- Set the participant mode i.e.
SEND_AND_RECV
orSIGNALLING_ONLY
. - Default value is
SEND_AND_RECV
.
- type:
Returns​
Example​
CustomTrack videoTrack = await VideoSDK.createCameraVideoTrack(
encoderConfig: CustomVideoTrackConfig.h1440p_w1920p,
multiStream: false,
);
//Creating Custom Audio Track
CustomTrack audioTrack = await VideoSDK.createMicrophoneAudioTrack(
encoderConfig: CustomAudioTrackConfig.high_quality);
// Create VideoSDK Room
Room room = VideoSDK.createRoom(
roomId: "<ROOM-ID>",
token: "<TOKEN>",
displayName: "<DISPLAY-NAME>",
micEnabled: false,
camEnabled: false,
maxResolution: 'hd',
multiStream: false,
defaultCameraIndex: 1, // Front Camera
customCameraVideoTrack: videoTrack, // custom video track :: optional
customMicrophoneAudioTrack: audioTrack, // custom audio track :: optional
notification: const NotificationInfo(
title: "Video SDK",
message: "Video SDK is sharing screen in the room",
icon: "notification_share",
),
);
loadMediaDevices()​
- This method is used to load or refresh MediaDevices i.e. Audio Devices and Video Devices.
Returns​
Future<Map<MediaDeviceType, List<MediaDeviceInfo>>>
Example​
Map<MediaDeviceType, List<MediaDeviceInfo>> mediaDevices = await VideoSDK.loadMediaDevices();
createCameraVideoTrack​
- You can create a Video Track using
createCameraVideoTrack()
method ofVideoSDK
class. - This method can be used to create video track using different encoding parameters, camera facing mode, and optimization mode.
Parameters​
-
cameraId:
- type:
String
- required:
false
- It will be the id of the camera from which the video should be captured.
- type:
-
encoderConfig:
- type:
CustomVideoTrackConfig
- required:
false
- default:
h360p_w640p
- Allowed values :
h90p_w160p
|h180p_w320p
|h216p_w384p
|h360p_w640p
|h540p_w960p
|h720p_w1280p
|h1080p_w1920p
|h1440p_w2560p
|h2160p_w3840p
|h120p_w160p
|h180p_w240p
|h240p_w320p
|h360p_w480p
|h480p_w640p
|h540p_w720p
|h720p_w960p
|h1080p_w1440p
|h1440p_w1920p
- It will be the encoderConfigs you can want to use for the Video Track.
- type:
note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
-
facingMode:
- type:
String
- required:
false
- Allowed values :
user
|environment
- It will specify whether to use front or back camera for the video track.
- type:
-
multiStream
- type:
boolean
- required:
false
- default: true
- It will specify if the stream should send multiple resolution layers or single resolution layer.
info- For meetings with fewer than or equal to four participants, setting
multiStream:false
is regarded as best practice. - This parameter is only available from
v1.0.9
.
- type:
Returns​
Future<CustomTrack>
Example​
CustomTrack videoTrack = await VideoSDK.createCameraVideoTrack(
encoderConfig: CustomVideoTrackConfig.h1440p_w1920p,
multiStream: false,
facingMode:"user",
);
createMicrophoneAudioTrack​
- You can create a Audio Track using
createMicrophoneAudioTrack()
method ofVideoSDK
class. - This method can be used to create audio track using different encoding parameters and noise cancellation configuration.
Parameters​
-
microphoneId:
- type:
String
- required:
false
- It will be the id of the mic from which the audio should be captured.
- type:
-
encoderConfig:
- type:
CustomTrackAudioConfig
- required:
false
- default:
speech_standard
- Allowed values :
speech_low_quality
|speech_standard
|music_standard
|standard_stereo
|high_quality
|high_quality_stereo
- It will be the encoder configuration you want to use for Audio Track.
- type:
-
noiseConfig
-
echoCancellation
- type:
boolean
- required:
false
- If
true
echo cancellation will turned on else it would be turned off.
- type:
-
autoGainControl
- type:
boolean
- required:
false
- If
true
auto gain will turned on else it would be turned off.
- type:
-
noiseSuppression
- type:
boolean
- required:
false
- If
true
noise suppression will turned on else it would be turned off.
- type:
-
Returns​
Future<CustomTrack>
Example​
CustomTrack audioTrack = await VideoSDK.createMicrophoneAudioTrack(
encoderConfig: CustomAudioTrackConfig.high_quality);
Got a Question? Ask us on discord