StaticConstantsStaticcheckOptionalpermissions: stringSpecifies the type of media permission to request.
Allowed value: Permission
A Promise that resolves to a Map<string, boolean> where:
true indicates permission is grantedfalse indicates permission is deniedtry {
const checkAudioVideoPermission = await VideoSDK.checkPermissions(
VideoSDK.Constants.permission.AUDIO_AND_VIDEO
);
console.log(
"check Audio and Video Permissions",
checkAudioVideoPermission.get(VideoSDK.Constants.permission.AUDIO),
checkAudioVideoPermission.get(VideoSDK.Constants.permission.VIDEO)
);
} catch (ex) {
console.log("Error in checkPermissions", ex);
}
Note
This method will throw an error if the browser does not support permission checking functionality.
StaticconfigAuthentication token used to authorize SDK operations.
You can generate a token in the following ways:
StaticcreateOptionaloptions: {OptionalbitrateMode?: "high_quality" | "balanced" | "bandwidth_optimized"Controls the video quality and bandwidth consumption. You can choose between high_quality for the best picture, bandwidth_optimized to save data, or balanced for a mix of both. Defaults to balanced.
Allowed Value: BitrateMode
OptionalcameraId?: stringIt will be the id of the camera from which the video should be captured.
OptionalencoderConfig?: You can choose from the below mentioned list of values for the encoder config.
Supported values include:
| Encoder Config | Resolution | Frame Rate | Optimized (kbps) | Balanced (kbps) | High Quality (kbps) |
|---|---|---|---|---|---|
| h90p_w160p | 160x90 | 15 fps | 60 | 100 | 150 |
| h180p_w320p | 320x180 | 15 fps | 100 | 150 | 250 |
| h216p_w384p | 384x216 | 15 fps | 120 | 200 | 350 |
| h360p_w640p | 640x360 | 20 fps | 200 | 400 | 600 |
| h540p_w960p | 960x540 | 25 fps | 350 | 550 | 800 |
| h720p_w1280p | 1280x720 | 30 fps | 1000 | 1500 | 2000 |
| h1080p_w1920p | 1920x1080 | 30 fps | 1600 | 2200 | 2700 |
| h1440p_w2560p | 2560x1440 | 30 fps | 5000 | 5500 | 6000 |
| h2160p_w3840p | 3840x2160 | 30 fps | 8000 | 8500 | 9000 |
| h120p_w160p | 160x120 | 15 fps | 60 | 100 | 150 |
| h180p_w240p | 240x180 | 15 fps | 100 | 150 | 250 |
| h240p_w320p | 320x240 | 15 fps | 120 | 200 | 350 |
| h360p_w480p | 480x360 | 20 fps | 200 | 400 | 600 |
| h480p_w640p | 640×480 | 25 fps | 300 | 500 | 700 |
| h540p_w720p | 720×540 | 30 fps | 350 | 550 | 800 |
| h720p_w960p | 960×720 | 30 fps | 900 | 1300 | 1600 |
| h1080p_w1440p | 1440×1080 | 30 fps | 1600 | 2200 | 2700 |
| h1440p_w1920p | 1920×1440 | 30 fps | 3500 | 4000 | 4500 |
Note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
OptionalfacingMode?: "user" | "environment"It will specify whether to use front or back camera for the video track.
OptionalmaxLayer?: 2 | 3Specifies the maximum number of simulcast layers to publish. This parameter only has an effect if multiStream is set to true.
OptionalmultiStream?: booleanIt 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:falseis regarded as best practice.
OptionaloptimizationMode?: "text" | "motion" | "detail"It will specify the optimization mode for the video track being generated.
StaticcreateOptionaloptions: {OptionalencoderConfig?: Default: "speech_standard"
| Encoder Config | Bitrate | Auto Gain | Echo Cancellation | Noise Suppression |
|---|---|---|---|---|
| speech_low_quality | 16 kbps | TRUE | TRUE | TRUE |
| speech_standard | 24 kbps | TRUE | TRUE | TRUE |
| music_standard | 32 kbps | FALSE | FALSE | FALSE |
| standard_stereo | 64 kbps | FALSE | FALSE | FALSE |
| high_quality | 128 kbps | FALSE | FALSE | FALSE |
| high_quality_stereo | 192 kbps | FALSE | FALSE | FALSE |
OptionalmicrophoneId?: stringIt will be the id of the mic from which the audio should be captured.
OptionalnoiseConfig?: {Configuration for audio noise processing.
If true auto gain will turned on else it would be turned off.
If true echo cancellation will turned on else it would be turned off.
If true noise suppression will turned on else it would be turned off.
StaticcreateOptionaloptions: {OptionalencoderConfig?: You can choose from the below mentioned list of values for the encoder config.
| Encoder Config | Resolution | Frame Rate | Bitrate |
|---|---|---|---|
| h360p_30fps | 640x360 | 30 fps | 400 kbps |
| h480p_15fps | 854x480 | 15 fps | 300 kbps |
| h480p_30fps | 854x480 | 30 fps | 500 kbps |
| h720p_5fps | 1280x720 | 5 fps | 400 kbps |
| h720p_15fps | 1280x720 | 15 fps | 1000 kbps |
| h720p_30fps | 1280x720 | 30 fps | 1500 kbps |
| h1080p_15fps | 1920x1080 | 15 fps | 1500 kbps |
| h1080p_30fps | 1920x1080 | 30 fps | 2000 kbps |
Note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
OptionalmultiStream?: booleanIt will specify if the stream should send multiple resolution layers or single resolution layer.
OptionaloptimizationMode?: "text" | "motion" | "detail"Optimization strategy for screen sharing.
OptionalwithAudio?: "enable" | "disable"Enables or disables audio during screen sharing.
StaticgetPromise resolves with an array of CameraDeviceInfo objects.StaticgetPromise resolves with an array of DeviceInfo objects.StaticgetPromise resolves with an array of MicrophoneDeviceInfo objects.StaticgetPromise that resolves with network speed statistics or rejects if the operation fails or exceeds the specified timeout.downloadSpeed and uploadSpeed, expressed in megabytes per second (MB/s).Optionaloptions: { timeoutDuration?: number }OptionaltimeoutDuration?: numberIt helps prevent the method from getting stuck indefinitely when fetching network statistics. It lets you set a maximum time for the operation, and if it takes longer than that, the method stops gracefully.
You can specify timeoutDuration in milliseconds. If it is not provided or is not an integer, the default timeout is set to 60,000 milliseconds (1 minute).
try {
const options = { timeoutDuration: 45000 }; // 45 seconds
const networkStats = await VideoSDK.getNetworkStats(options);
// will return value in Mb/s
console.log("Download Speed: ", networkStats["downloadSpeed"]);
console.log("Upload Speed: ", networkStats["uploadSpeed"]);
} catch (ex) {
console.log("Error in networkStats:", ex);
}
StaticgetPromise resolves with an array of PlaybackDeviceInfo objects.StaticinitMeeting instance.Configuration options for initializing the meeting.
OptionalcustomCameraVideoTrack?: MediaStreamCustom camera video track to use as the camera input.
If this is not provided, the SDK will automatically create and use a default camera video track. You can create a custom track using createCameraVideoTrack.
OptionalcustomMicrophoneAudioTrack?: MediaStreamCustom microphone audio track to use as the microphone input.
If this is not provided, the SDK will automatically create and use a default microphone audio track.You can create a custom track using createMicrophoneAudioTrack.
OptionaldebugMode?: booleanEnables detailed SDK logs in the dashboard.
OptionaldefaultCamera?: "user" | "enviornment"Specifies which camera to use by default.
user → front cameraenvironment → rear cameraOptionalmaxResolution?: "hd" | "sd"Maximum resolution for video publishing.
Unique ID of the meeting to join. Please refer this documentation to create a room.
OptionalmetaData?: objectCustom metadata associated with the participant.
OptionalmicEnabled?: booleanEnables microphone on join.
Optionalmode?: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"Defines how media streams should behave.There are 3 types of modes
OptionalmultiStream?: booleanEnables or disables multi-resolution streaming.
Optionalname?: stringDisplay name of the participant.
OptionalparticipantId?: stringUnique participant identifier.
OptionalpreferredProtocol?: "UDP_ONLY" | "UDP_OVER_TCP" | "TCP_ONLY"Preferred network protocol for media transmission.
Allowed Value:
OptionalsignalingBaseUrl?: stringIf you want to use a proxy server with the VideoSDK, you can specify your baseURL here.
Note
If you intend to use a proxy server with the VideoSDK, priorly inform us at support@videosdk.live
OptionalwebcamEnabled?: booleanEnables webcam on join.
StaticoffRemoves an event listener that was previously registered.
Event name to which you want to unsubscribe.
Callback function which was passed while subscribing to the event
To view the complete list of available events and their details, refer to VideosdkEvent
StaticonRegisters an event listener.
Event name to which you want to subscribe.
Callback function which will be triggered when the event happens
To view the complete list of available events and their details, refer to VideosdkEvent
StaticrequestOptionalpermissions: stringSpecifies the type of media permission to request.
Allowed value: Permission
try {
const requestPermission = await VideoSDK.requestPermission(
VideoSDK.Constants.permission.AUDIO_AND_VIDEO,
);
console.log(
"request Audio and Video Permissions",
requestPermission.get(VideoSDK.Constants.permission.AUDIO),
requestPermission.get(VideoSDK.Constants.permission.VIDEO)
);
} catch(ex)
{
console.log("Error in requestPermission ", ex);
}
Note
requestPermission()will throw an error when matching media is not available.
StaticsetkeyProvider.setSharedKey(...).import { ExternalE2EEKeyProvider } from "@videosdk.live/js-sdk";
const keyProvider = new ExternalE2EEKeyProvider();
keyProvider.setSharedKey("<SECRET_KEY>");
// Set the key provider before initializing the meeting.
// If the key is set before initialization, E2EE is enabled automatically.
VideoSDK.setKeyProvider(keyProvider);
const meeting = VideoSDK.initMeeting({
// ...
});
Promisethat resolves to aMap<string, boolean>indicating the permission status.