Interface CameraVideoTrackInitConfig

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

interface CameraVideoTrackInitConfig {
    cameraId?: string;
    encoderConfig?: string | VideoEncoderConfiguration;
    facingMode?: VideoFacingModeEnum;
    optimizationMode?: OptimizationMode;
}

Properties

cameraId?: string

Specifies the camera ID.

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

encoderConfig?: string | VideoEncoderConfiguration

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).
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.
optimizationMode?: OptimizationMode

Since


   4.2.0

Sets the video transmission optimization mode.

You can call this method during a video call, a live streaming or screen sharing to dynamically change the optimization mode. For example, during the screen sharing, before you change the shared content from text to video, you can change the optimization mode from "detail" to "motion" to ensure smoothness in poor network conditions.

Note: This method supports Chrome only.

Param: mode

The video transmission optimization mode:

  • "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": Since 4.21.0, the SDK 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.