CameraCapturerConfiguration
Configures camera capture preferences.
struct CameraCapturerConfiguration {
#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IOS) || defined(__OHOS__)
Optional<CAMERA_DIRECTION> cameraDirection;
Optional<CAMERA_FOCAL_LENGTH_TYPE> cameraFocalLengthType;
#else
Optional<const char *> deviceId;
#endif
#if defined(__ANDROID__)
Optional<const char *> cameraId;
#endif
Optional<bool> followEncodeDimensionRatio;
VideoFormat format;
};
Properties
- cameraDirection
- (Optional) Camera direction. See CAMERA_DIRECTION.
Note: (Android and iOS only)
- cameraFocalLengthType
- (Optional) Camera focal length type. See CAMERA_FOCAL_LENGTH_TYPE.
Note: (Android and iOS only)
- When setting the camera focal length type, only specifying the camera via
cameraDirectionis supported; specifying viacameraIdis not supported. - For iOS devices with multi-lens rear cameras (e.g., dual: wide and ultra-wide, or triple: wide, ultra-wide, and telephoto), you can achieve ultra-wide angle video capture in the following ways:
- 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, with a minimum of 0.5.
- Method 1: Set this parameter to
- When setting the camera focal length type, only specifying the camera via
- deviceId
- Camera ID, with a maximum length of MAX_DEVICE_ID_LENGTH_TYPE.
Note: (Windows and macOS only)
- cameraId
- (Optional) Camera ID.
Note: (Android only)
- This parameter is mutually exclusive with
cameraDirection; only one can be used. - Using
cameraDirectionis simpler, as you only need to specify the camera direction (front or rear), and the SDK will retrieve and confirm the actual camera ID using Android native APIs. - Using
cameraIdallows for more precise camera selection, suitable for multi-camera devices wherecameraDirectioncannot identify or access all cameras. In such cases, it is recommended to specify the target camera directly usingcameraId.
- This parameter is mutually exclusive with
- followEncodeDimensionRatio
- (Optional) Whether to follow the video aspect ratio set in setVideoEncoderConfiguration:
- true: (Default) Follow the configured video aspect ratio. The SDK crops the captured video according to the configured aspect ratio and updates the local preview and video frames in onCaptureVideoFrame and onPreEncodeVideoFrame accordingly.
- false: Do not follow the configured video aspect ratio. The SDK does not change the aspect ratio of the captured video frames.
- format
- (Optional) Format of the video frame. See VideoFormat.