Skip to main content
Version: 0.x.x

Custom Video Track - React

  • You can create a Video Track using createCameraVideoTrack() method of @videosdk.live/react-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.
  • encoderConfig:

    • type: String
    • required: false
    • default: h360p_w640p
    • You can choose from the below mentioned list of values for the encoder config.
Encoder ConfigResolutionFrame RateOptimized (kbps)Balanced (kbps)High Quality (kbps)
h90p_w160p160x9015 fps60100150
h180p_w320p320x18015 fps100150250
h216p_w384p384x21615120200350
h360p_w640p640x36020200400600
h540p_w960p960x54025350550800
h720p_w1280p1280x72030100015002000
h1080p_w1920p1920x108030160022002700
h1440p_w2560p2560x144030500055006000
h2160p_w3840p3840x216030800085009000
h120p_w160p160x1201560100150
h180p_w240p240x18015100150250
h240p_w320p320x24015120200350
h360p_w480p480x36020200400600
h480p_w640p640×48025300500700
h540p_w720p720×54030350550800
h720p_w960p960×7203090013001600
h1080p_w1440p1440×108030160022002700
h1440p_w1920p1920×144030350040004500
note

Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.

  • facingMode:

    • type: String
    • required: false
    • Allowed values : front | environment
    • It will specify whether to use front or back camera for the video track.
  • optimizationMode

    • type: String
    • required: false
    • Allowed values: motion | text | detail
    • It will specify the optimization mode for the video track being generated.
  • multiStream

    • type: boolean
    • required: false
    • default: true
    • It will specify if the stream should send multiple resolution layers or single resolution layer.
  • bitrateMode:

    • type: String
    • required: false
    • Allowed values : bandwidth_optimized | balanced | high_quality
    • 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.
  • 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 multiStream is set to true.
info
  • To learn more about optimizations and best practices for using custom video tracks, follow this guide.
  • This parameter is only available from v0.1.53.

Returns

  • MediaStream

Example

import { createCameraVideoTrack , Constants} from "@videosdk.live/react-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

  • You can create a Audio Track using createMicrophoneAudioTrack() method of @videosdk.live/react-sdk.
  • This method can be used to create audio track using different encoding parameters and noise cancellation configration.

Parameters

  • microphoneId:

    • type: String
    • required: false
    • It will be the id of the mic from which the audio should be captured.
  • encoderConfig:

    • type: String
    • required: false
    • default: speech_standard
    • You can choose from the below mentioned list of values for the encoder config.
Encoder ConfigBitrateAuto GainEcho CancellationNoise Suppression
speech_low_quality16 kbpsTRUETRUETRUE
speech_standard24 kbpsTRUETRUETRUE
music_standard32 kbpsFALSEFALSEFALSE
standard_stereo64 kbpsFALSEFALSEFALSE
high_quality128 kbpsFALSEFALSEFALSE
high_quality_stereo192 kbpsFALSEFALSEFALSE
  • noiseConfig

    • echoCancellation

      • type: boolean
      • required: false
      • If true echo cancellation will turned on else it would be turned off.
    • autoGainControl

      • type: boolean
      • required: false
      • If true auto gain will turned on else it would be turned off.
    • noiseSuppression

      • type: boolean
      • required: false
      • If true noise suppression will turned on else it would be turned off.

Returns

  • MediaStream

Example

import { createMicrophoneAudioTrack } from "@videosdk.live/react-sdk";

let customTrack = await createMicrophoneAudioTrack({
encoderConfig: "speech_standard",
noiseConfig: {
noiseSuppression: true,
echoCancellation: true,
autoGainControl: true,
},
});

Custom Screen Share Track - React

  • You can create a Video Track using createScreenShareVideoTrack() method of @videosdk.live/react-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.
Encoder ConfigResolutionFrame RateBitrate (High)
h360p_30fps640x36030 fps400 kbps
h480p_15fps854x48015 fps300 kbps
h480p_30fps854x48030 fps500 kbps
h720p_5fps1280x7205 fps400 kbps
h720p_15fps1280x72015 fps1000 kbps (1 Mbps)
h720p_30fps1280x72030 fps1500 kbps (1.5 Mbps)
h1080p_15fps1920x108015 fps1500 kbps (1.5 Mbps)
h1080p_30fps1920x108030 fps2000 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.3.4+:
    • h480p_15fps
    • h480p_30fps
    • h720p_30fps
  • optimizationMode
    • type: String
    • required: false
    • Allowed values: motion | text | detail
    • It will specify the optimization mode for the video track being generated.

Returns

  • MediaStream

Example

import { createScreenShareVideoTrack } from "@videosdk.live/react-sdk";

let customTrack = await createScreenShareVideoTrack({
optimizationMode: "motion",
encoderConfig: "h720p_15fps",
});

Got a Question? Ask us on discord