Custom Video Track - React Native
- You can create a Video Track using
createCameraVideoTrack()method of@videosdk.live/react-native-sdk. - This method can be used to create video track using different encoding parameters, camera facing mode, bitrateMode, maxLayer 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:
String - required:
false - default:
h360p_w640p - You can choose from the below mentioned list of values for the encoder config.
- type:
| Encoder Config | Resolution | Frame Rate | Optimized (kbps) | Balanced (kbps) | High Quality (kbps) |
|---|---|---|---|---|---|
| h144p_w192p | 192x144 | 15 fps | 60 | 100 | 150 |
| h240p_w320p | 320x240 | 15 fps | 80 | 150 | 300 |
| h480p_w640p | 640x480 | 25 fps | 300 | 500 | 700 |
| h720p_w960p | 960x720 | 30 fps | 800 | 1200 | 1600 |
| h1080p_w1440p | 1440x1080 | 30 fps | 1600 | 2200 | 2700 |
| h90p_w160p | 160x90 | 15 fps | 60 | 100 | 150 |
| h360p_w640p | 640x360 | 20 fps | 200 | 400 | 600 |
| h720p_w1280p | 1280x720 | 30 fps | 1000 | 1500 | 2000 |
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:
-
optimizationMode
- type:
String - required:
false - Allowed values:
motion|text|detail - It will specify the optimization mode for the video track being generated.
- type:
-
multiStream
- type:
boolean - required:
false - default:
true - It will specify if the stream should send multiple resolution layers or single resolution layer.
- type:
-
bitrateMode:
- type:
String - required:
false - Allowed values :
bandwidth_optimized|balanced|high_quality - Controls the video quality and bandwidth consumption. You can choose between
high_qualityfor the best picture,bandwidth_optimizedto save data, orbalancedfor a mix of both. Defaults tobalanced.
- type:
-
maxLayer:
- type:
Number - required:
false - Allowed values :
2|3 - default:
3 - Specifies the maximum number of simulcast layers to publish. This parameter only has an effect if
multiStreamis set to true.
- type:
info
- To learn more about optimizations and best practices for using custom video tracks, follow this guide.
- This parameter is only available from
v0.0.26.
Returns
MediaStream
Example
import { createCameraVideoTrack , Constants} from "@videosdk.live/react-native-sdk";
let customTrack = await createCameraVideoTrack({
optimizationMode: "motion",
encoderConfig: "h720p_w1280p",
facingMode: "environment",
multiStream: true,
bitrateMode: Constants.BitrateMode.BANDWIDTH_OPTIMIZED,
maxLayer: 2
});
Custom Audio Track - React Native
- You can create a Audio Track using
createMicrophoneAudioTrack()method of@videosdk.live/react-native-sdk. - This method can be used to create audio track using different encoding parameters and noise cancellation configration.
Parameters
-
encoderConfig:
- type:
String - required:
false - default:
speech_standard - You can choose from the below mentioned list of values for the encoder config.
- type:
| 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 |
-
noiseConfig
-
echoCancellation
- type:
boolean - required:
false - If
true, echo cancellation would be turned on; otherwise, it would be off.
- type:
-
autoGainControl
- type:
boolean - required:
false - If
true, auto gain would be turned on; otherwise, it would be off.
- type:
-
noiseSuppression
- type:
boolean - required:
false - If
true, noise suppression would be turned on; otherwise, it would be off.
- type:
-
Returns
MediaStream
Example
import { createMicrophoneAudioTrack } from "@videosdk.live/react-native-sdk";
let customTrack = await createMicrophoneAudioTrack({
encoderConfig: "speech_standard",
noiseConfig: {
noiseSuppression: true,
echoCancellation: true,
autoGainControl: true,
},
});
Custom Screen Share Track - React Native
- You can create a Video Track using
createScreenShareVideoTrack()method of@videosdk.live/react-native-sdk. - 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 choose from the below mentioned list of values for the encoder config.
- type:
| Encoder Config | Resolution | Frame Rate | Bitrate |
|---|---|---|---|
| h360p_30fps | 640x360 | 3 fps | 200000 kbps |
| h720p_5fps | 1280x720 | 5 fps | 400000 kbps |
| h720p_15fps | 1280x720 | 15 fps | 1000000 kbps |
| h1080p_15fps | 1920x1080 | 15 fps | 1500000 kbps |
| h1080p_30fps | 1920x1080 | 15 fps | 1000000 kbps |
note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
- 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
import { createScreenShareVideoTrack } from "@videosdk.live/react-native-sdk";
let customTrack = await createScreenShareVideoTrack({
optimizationMode: "motion",
encoderConfig: "h720p_15fps",
});
Got a Question? Ask us on discord

