CameraCapturerConfiguration

Camera capture configuration.

public class CameraCapturerConfiguration : IOptionalJsonParse
    {
        public Optional<CAMERA_DIRECTION> cameraDirection = new Optional<CAMERA_DIRECTION>();
        public Optional<CAMERA_FOCAL_LENGTH_TYPE> cameraFocalLengthType = new Optional<CAMERA_FOCAL_LENGTH_TYPE>();
        public Optional<string> deviceId = new Optional<string>();
        public Optional<string> cameraId = new Optional<string>();
        public Optional<bool> followEncodeDimensionRatio = new Optional<bool>();
        public VideoFormat format;

        public CameraCapturerConfiguration()
        {
            this.format = new VideoFormat(0, 0, 0);
        }

        public CameraCapturerConfiguration(Optional<CAMERA_DIRECTION> cameraDirection, Optional<CAMERA_FOCAL_LENGTH_TYPE> cameraFocalLengthType, Optional<string> deviceId, Optional<string> cameraId, Optional<bool> followEncodeDimensionRatio, VideoFormat format)
        {
            this.cameraDirection = cameraDirection;
            this.cameraFocalLengthType = cameraFocalLengthType;
            this.deviceId = deviceId;
            this.cameraId = cameraId;
            this.followEncodeDimensionRatio = followEncodeDimensionRatio;
            this.format = format;
        }
    }

Properties

cameraDirection
(Optional) Camera direction. See CAMERA_DIRECTION.
Note: This parameter applies to Android and iOS only.
cameraId
(Optional) Camera ID. Defaults to the ID of the front-facing camera. You can obtain the camera ID via Android native system APIs. See Camera.open()) and CameraManager.getCameraIdList().
Note:
  • This parameter applies to Android only.
  • This parameter and cameraDirection are both used to specify the camera and are mutually exclusive. You can choose either one as needed. The differences are as follows:
  • Using cameraDirection is simpler. You only need to specify the direction (front or rear), and the SDK will retrieve and determine the actual camera ID using system APIs.
  • Using cameraId allows you to precisely specify a particular camera. On multi-camera devices, cameraDirection may not be able to identify or access all available cameras. In such cases, it is recommended to use cameraId to directly specify the desired camera ID.
cameraFocalLengthType
(Optional) Camera focal length type. See CAMERA_FOCAL_LENGTH_TYPE.
Note:
  • This parameter applies to Android and iOS only.
  • To set the camera focal length type, only cameraDirection is supported. cameraId is not supported.
  • Some iOS devices have composite rear cameras, such as dual (wide and ultra-wide) or triple (wide, ultra-wide, and telephoto) lenses. For such composite lenses with ultra-wide capabilities, you can achieve ultra-wide capture using either of the following methods:
  • Method 1: Set this parameter to CAMERA_FOCAL_LENGTH_ULTRA_WIDE (2) (ultra-wide lens).
  • Method 2: Set this parameter to CAMERA_FOCAL_LENGTH_DEFAULT (0) (standard lens), then call SetCameraZoomFactor to set the camera zoom factor to a value less than 1.0 (minimum 0.5).
The difference is that Method 1 provides a fixed ultra-wide view, while Method 2 allows flexible zoom adjustment.
format
(Optional) Video frame format. See VideoFormat.
deviceId
(Optional) ID of the camera.
Note: This parameter applies to Windows and macOS only.
followEncodeDimensionRatio
(Optional) Whether to follow the video aspect ratio set in SetVideoEncoderConfiguration:
  • true: (Default) Follow. The SDK crops the captured video to match the configured aspect ratio, and this affects local preview, OnCaptureVideoFrame, and OnPreEncodeVideoFrame.
  • false: Do not follow. The SDK does not change the aspect ratio of the captured video frames.