Custom Screen Share Track - Javascript
We have introduced the ability to pass a custom Screen Share track while sharing the screen of participants. This feature can be used to add custom video encoder config, optimization mode (whether you want to focus on motion, text or detail of the video) and background removal & video filter from external SDK(e.g., Banuba) and send it to other participants.
Creating a Custom Screen Share Track
- You can create a Video Track using
createScreenShareVideoTrack()method ofVideoSDKclass. - This method can be used to create video track using different encoding parameters and optimization mode.
Parameters
-
encoderConfig:
- type:
String - required:
false - default:
h720p_15fps - You can chose from the below mentioned list of values for the encoder config.
- type:
| Encoder Config | Resolution | Frame Rate | Bitrate (High) |
|---|---|---|---|
| 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 (1 Mbps) |
| h720p_30fps | 1280x720 | 30 fps | 1500 kbps (1.5 Mbps) |
| h1080p_15fps | 1920x1080 | 15 fps | 1500 kbps (1.5 Mbps) |
| h1080p_30fps | 1920x1080 | 30 fps | 2000 kbps (2 Mbps) |
note
- Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
- The following encoder configurations are newly added in SDK v0.2.5+:
h480p_15fpsh480p_30fpsh720p_30fps
- optimizationMode
- type:
String - required:
false - Allowed values:
motion|text|detail - It will specify the optimization mode for the video track being generated.
- type:
Returns
MediaStream
Example
let customTrack = await VideoSDK.createScreenShareVideoTrack({
optimizationMode: "motion",
encoderConfig: "h720p_15fps",
});
Using Custom Screen Share Track
Custom Track with enableScreenShare()
In order to switch tracks during the meeting, you have to pass the MediaStream in the meeting.enableScreenShare() method.
note
Make sure to call disableScreenShare() before you create a new track as it may lead to unexpected behavior.
let customTrack = await VideoSDK.createScreenShareVideoTrack({
optimizationMode: "motion",
encoderConfig: "h720p_15fps",
});
meeting.enableScreenShare(customTrack);
Got a Question? Ask us on discord

