Represents a camera device discovered by the Camera.getAvailableCameraDevices | Camera.getAvailableCameraDevices() function

interface CameraDevice {
    formats: CameraDeviceFormat[];
    hardwareLevel: "legacy" | "limited" | "full";
    hasFlash: boolean;
    hasTorch: boolean;
    id: string;
    isMultiCam: boolean;
    maxExposure: number;
    maxZoom: number;
    minExposure: number;
    minFocusDistance: number;
    minZoom: number;
    name: string;
    neutralZoom: number;
    physicalDevices: PhysicalCameraDeviceType[];
    position: CameraPosition;
    sensorOrientation: Orientation;
    supportsFocus: boolean;
    supportsLowLightBoost: boolean;
    supportsRawCapture: boolean;
}

Properties

All available formats for this camera device. Use this to find the best format for your use case and set it to the Camera's CameraProps.format | Camera's .format property.

See the Camera Formats documentation for more information about Camera Formats.

hardwareLevel: "legacy" | "limited" | "full"

The hardware level of the Camera.

  • On Android, some older devices are running at a legacy or limited level which means they are running in a backwards compatible mode.
  • On iOS, all devices are full.
hasFlash: boolean

Specifies whether this camera supports enabling flash for photo capture.

hasTorch: boolean

Specifies whether this camera supports continuously enabling the flash to act like a torch (flash with video capture)

id: string

The native ID of the camera device instance.

isMultiCam: boolean

A property indicating whether the device is a virtual multi-camera consisting of multiple combined physical cameras.

Examples:

  • The Dual Camera, which supports seamlessly switching between a wide and telephoto camera while zooming and generating depth data from the disparities between the different points of view of the physical cameras.
  • The TrueDepth Camera, which generates depth data from disparities between a YUV camera and an Infrared camera pointed in the same direction.
maxExposure: number

The maximum Exposure-Bias value this format supports. When setting the exposure to this value, the image is almost completely bright (over-exposed).

maxZoom: number

Maximum available zoom factor (e.g. 128)

minExposure: number

The minimum Exposure-Bias value this format supports. When setting the exposure to this value, the image is almost completely dark (under-exposed).

minFocusDistance: number

The minimum distance this device can properly focus to (in centimeters/cm) or 0 if unknown.

minZoom: number

Minimum available zoom factor (e.g. 1)

name: string

A friendly localized name describing the camera.

neutralZoom: number

The zoom factor where the camera is "neutral".

  • For single-physical cameras this property is always 1.0.
  • For multi cameras this property is a value between minZoom and maxZoom, where the camera is in wide-angle mode and hasn't switched to the ultra-wide-angle ("fish-eye") or telephoto camera yet.

Use this value as an initial value for the zoom property if you implement custom zoom. (e.g. reanimated shared value should be initially set to this value)

Example

const device = ...

const zoom = useSharedValue(device.neutralZoom) // <-- initial value so it doesn't start at ultra-wide
const cameraProps = useAnimatedProps(() => ({
zoom: zoom.value
}))
physicalDevices: PhysicalCameraDeviceType[]

The physical devices this CameraDevice consists of.

  • If this camera device is a logical camera (combination of multiple physical cameras, e.g. "Triple Camera"), there are multiple cameras in this array.
  • If this camera device is a physical camera (e.g. "wide-angle-camera"), there is only a single element in this array.

You can check if the camera is a logical multi-camera by using the isMultiCam property.

position: CameraPosition

Specifies the physical position of this camera.

  • back: The Camera Device is located on the back of the phone. These devices can be used for capturing what's in front of the user.
  • front: The Camera Device is located on the front of the phone. These devices can be used for selfies or FaceTime.
  • external: The Camera Device is an external device. These devices can be either:
sensorOrientation: Orientation

Represents the sensor's orientation relative to the phone. For most phones this will be landscape, as Camera sensors are usually always rotated by 90 degrees (i.e. width and height are flipped).

All Camera streams will stream in this orientation. To properly rotate the buffers "up-right", frames will need to be counter-rotated by this orientation here.

  • For photo and video capture this is handled using EXIF flags.
  • For preview this is handled using view transforms (rotate + translate matrix).
  • For frame processors this needs to be handled manually by the user (see Frame.orientation)
supportsFocus: boolean

Specifies whether this device supports focusing (Camera.focus | Camera.focus(...))

supportsLowLightBoost: boolean

Whether this camera device supports low light boost.

supportsRawCapture: boolean

Whether this camera supports taking photos in RAW format

! Work in Progress !