Interface CameraVideoTrackInitConfig

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

Hierarchy

  • CameraVideoTrackInitConfig

Index

Properties

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: 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

The video transmission optimization mode:

  • "detail": Prioritizes video quality.
    • The browser 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 browser does not reduce the sending resolution, but may reduce the frame rate.
  • "motion": Since v4.21.0, the browser prioritizes video smoothness.
    • In poor network conditions, the browser reduces the sending bitrate to minimize video freezes.
    • In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution.
  • "balanced": The default optimization mode.
    • For screen sharing video streams, the SDK default optimization strategy is quality-first.
    • For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted.