React Api Reference
    Preparing search index...

    Function createCameraVideoTrack

      • This method can be used to create video track using different encoding parameters, camera facing mode, bitrateMode, maxLayer and optimization mode.

      Parameters

      • Optionaloptions: {
            bitrateMode?: "high_quality" | "balanced" | "bandwidth_optimized";
            cameraId?: string;
            encoderConfig?:
                | "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";
            facingMode?: "environment"
            | "user";
            maxLayer?: 2 | 3;
            multiStream?: boolean;
            optimizationMode?: "text" | "motion" | "detail";
        }
        • 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

          BitrateMode.BALANCED
          
        • OptionalcameraId?: string

          It will be the id of the camera from which the video should be captured.

        • OptionalencoderConfig?:
              | "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"

          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.

          "h720p_w1280p"
          
        • OptionalfacingMode?: "environment" | "user"

          It will specify whether to use front or back camera for the video track.

        • OptionalmaxLayer?: 2 | 3

          Specifies the maximum number of simulcast layers to publish. This parameter only has an effect if multiStream is set to true.

        • OptionalmultiStream?: boolean

          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.

          true
          
        • OptionaloptimizationMode?: "text" | "motion" | "detail"

          It will specify the optimization mode for the video track being generated.

      Returns Promise<MediaStream>

      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
      });