Interface CameraVideoTrackInitConfig

Configurations for the video track from the video captured by a camera. Set these configurations when calling AgoraRTC.createCameraVideoTrack.


  • CameraVideoTrackInitConfig



Optional cameraId

cameraId: string

Specifies the camera ID.

You can get a list of the available cameras by calling AgoraRTC.getCameras.

Optional encoderConfig

The video encoder configurations.

You can set the video encoder configurations in either of the following ways:

  • Pass the preset video encoder configurations by using VideoEncoderConfigurationPreset.
  • Pass your customized video encoder configurations by using VideoEncoderConfiguration.
  • Leave this property empty to use the SDK's default value, "480p_1" (resolution: 640 × 480, frame rate: 15 fps, bitrate: 500 Kbps).

Optional facingMode

facingMode: VideoFacingModeEnum

Whether to user the front camera or the rear camera.

You can use this parameter to choose between the front camera and the rear camera on a mobile device:

  • "user": The front camera.
  • "environment": The rear camera.

Optional optimizationMode

optimizationMode: "motion" | "detail"


Transmission optimization mode. Whether to prioritize video quality or smoothness:

  • "detail": Prioritizes video quality.
    • The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value.
    • In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate.
  • "motion": Prioritizes video smoothness.
    • In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes.
    • In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution.
  • Empty: Uses the default transmission optimization mode. The SDK may reduce the frame rate or the sending resolution in poor network conditions.

Note: This method is only supported on Chrome.