Agora Java API Reference for Android

Classes | Public Member Functions | Public Attributes | List of all members
io.agora.rtc2.video.CameraCapturerConfiguration Class Reference

The camera capturer preference. More...

## Classes
enum | CAMERA_DIRECTION
| The camera direction. More...
enum | CAMERA_FOCAL_LENGTH_TYPE
| The camera focal length types. More...
class | CaptureFormat
| The format of the video frame. More...

## Public Member Functions
| CameraCapturerConfiguration (CAMERA_DIRECTION cameraDirection)
| CameraCapturerConfiguration (CAMERA_DIRECTION cameraDirection, CAMERA_FOCAL_LENGTH_TYPE cameraFocalLengthType)
| CameraCapturerConfiguration (CaptureFormat captureFormat)
| CameraCapturerConfiguration (CAMERA_DIRECTION cameraDirection, CaptureFormat captureFormat)
| CameraCapturerConfiguration (CAMERA_DIRECTION cameraDirection, CAMERA_FOCAL_LENGTH_TYPE cameraFocalLengthType, CaptureFormat captureFormat)
CAMERA_DIRECTION | getCameraDirection ()
String | getCameraId ()
CAMERA_FOCAL_LENGTH_TYPE | getCameraFocalLengthType ()
CaptureFormat | getCaptureFormat ()
Boolean | isFollowEncodeDimensionRatio ()
String | toString ()

## Public Attributes
CAMERA_DIRECTION | cameraDirection = null
String | cameraId = null
CAMERA_FOCAL_LENGTH_TYPE | cameraFocalLengthType = null
CaptureFormat | captureFormat
Boolean | followEncodeDimensionRatio = null

## Detailed Description

The camera capturer preference.

## Constructor & Destructor Documentation

## ◆ CameraCapturerConfiguration() [1/3]

io.agora.rtc2.video.CameraCapturerConfiguration.CameraCapturerConfiguration | ( | CAMERA_DIRECTION | cameraDirection | ) |

The camera capture configuration.

Parameters

  cameraDirection | The camera direction. For details, see CAMERA_DIRECTION.

## ◆ CameraCapturerConfiguration() [2/3]

io.agora.rtc2.video.CameraCapturerConfiguration.CameraCapturerConfiguration | ( | CaptureFormat | captureFormat | ) |

The camera capture configuration.

Parameters

  captureFormat | The camera capture format. For details, see {}.

## ◆ CameraCapturerConfiguration() [3/3]

io.agora.rtc2.video.CameraCapturerConfiguration.CameraCapturerConfiguration | ( | CAMERA_DIRECTION | cameraDirection,
|  | CaptureFormat | captureFormat
| ) |  |

The camera capture configuration.

Parameters

  cameraDirection | The camera direction. For details, see CAMERA_DIRECTION.
  captureFormat | The camera capture format. For details, see {}.

## Member Data Documentation

## ◆ cameraDirection

CAMERA_DIRECTION io.agora.rtc2.video.CameraCapturerConfiguration.cameraDirection = null

(Optional) The camera direction. See `CAMERA_DIRECTION`.

## ◆ cameraId

String io.agora.rtc2.video.CameraCapturerConfiguration.cameraId = null

(Optional) The camera ID. The default value is the camera ID of the front camera. You can get the camera ID through the Android native system API, see `Camera.open()` and `CameraManager.getCameraIdList()` for details.

Note
  - This parameter and `cameraDirection` are mutually exclusive in specifying the camera; you can choose one based on your needs. The differences are as follows:
    - Specifying the camera via `cameraDirection` is more straightforward. You only need to indicate the camera direction (front or rear), without specifying a specific camera ID; the SDK will retrieve and confirm the actual camera ID through Android native system APIs.
    - Specifying via `cameraId` allows for more precise identification of a particular camera. For devices with multiple cameras, where `cameraDirection` cannot recognize or access all available cameras, it is recommended to use `cameraId` to specify the desired camera ID directly.

## ◆ cameraFocalLengthType

CAMERA_FOCAL_LENGTH_TYPE io.agora.rtc2.video.CameraCapturerConfiguration.cameraFocalLengthType = null

(Optional) The camera focal length type. See `CAMERA_FOCAL_LENGTH_TYPE`.

Note
  To set the focal length type of the camera, it is only supported to specify the camera through `cameraDirection`, and not supported to specify it through `cameraId`.

## ◆ captureFormat

CaptureFormat io.agora.rtc2.video.CameraCapturerConfiguration.captureFormat

(Optional) The format of the video frame. See `CaptureFormat`.

## ◆ followEncodeDimensionRatio

Boolean io.agora.rtc2.video.CameraCapturerConfiguration.followEncodeDimensionRatio = null

(Optional) Whether to follow the video aspect ratio set in `setVideoEncoderConfiguration`:

- `true`: (Default) Follow the set video aspect ratio. The SDK crops the captured video according to the set video aspect ratio and synchronously changes the local preview screen and the video frame in `onCaptureVideoFrame` and `onPreEncodeVideoFrame`.
- `false`: Do not follow the system default audio playback device. The SDK does not change the aspect ratio of the captured video frame.