CameraDevice

interface CameraDevice extends HybridObject

The CameraDevice represents a physical- or virtual Camera Device.

Examples:

  • Physical: The 0.5x ultra-wide-angle Camera
  • Virtual: The Triple-Camera consisting of the 0.5x, the 1x, and the 3x Camera
  • TrueDepth Face ID: A virtual Camera consisting of a color, and a depth Camera

Properties

companionDeskViewCamera?

iOS
readonly optional companionDeskViewCamera: CameraDevice

The matching Desk View camera for this Continuity Camera, if available.


focalLength?

readonly optional focalLength: number

Returns the Camera Device's nominal focal length in 35mm film format.


formats

readonly formats: CameraFormat[]

Get a list of all supported CameraFormats this device exposes.

A CameraFormat defines the device's available stream combination map, including sizes (for video, photo, and streams), frame rates, dynamic ranges (HDR, SDR), pixel formats, and more.


hasFlash

readonly hasFlash: boolean

Whether this CameraDevice has a physical flash unit, or not.

For front-facing devices, hasFlash may be false, but you might still be able to use a screen- flash for photo capture.


hasTorch

readonly hasTorch: boolean

Whether this CameraDevice supports using its flash (hasFlash) as a continuous light ("torch") while the session is running.

In almost all cases, hasTorch is the same as hasFlash.


id

readonly id: string

A unique identifier for this camera device.


isContinuityCamera

iOS
readonly isContinuityCamera: boolean

Returns true if this camera is a Continuity Camera. On non iOS platforms this is always false.


isVirtualDevice

readonly isVirtualDevice: boolean

Gets whether this CameraDevice is a virtual device, which consists of two or more physical CameraDevices.

Devices like the "Triple-Camera" (0.5x + 1x + 3x) or the "FaceID Camera" (color + depth) are virtual devices.

To access the individual physical devices a virtual device consists of, use physicalDevices.


lensAperture

readonly lensAperture: number

The size (ƒ number) of the lens diaphragm.


localizedName

readonly localizedName: string

A user friendly camera name shown by the system.


manufacturer

readonly manufacturer: string

The hardware manufacturer name for this device.


maxExposureBias

readonly maxExposureBias: number

Gets the maximum supported value for the exposure bias (in EV units), or 0 if supportsExposureBias is false.


maxWhiteBalanceGain

readonly maxWhiteBalanceGain: number

The maximum value a single color-channel can be set to in WhiteBalanceGains.


maxZoom

readonly maxZoom: number

The maximum supported zoom value of this device.

Note

Some formats may decrease the available zoom, so make sure to always clamp to CameraFormat.maxZoomFactor if you select a custom CameraFormat.


minExposureBias

readonly minExposureBias: number

Gets the minimum supported value for the exposure bias (in EV units), or 0 if supportsExposureBias is false.


minZoom

readonly minZoom: number

The minimum supported zoom value.


modelID

readonly modelID: string

The model identifier for this camera device.


physicalDevices

readonly physicalDevices: CameraDevice[]

If this CameraDevice is a virtual device (see isVirtualDevice), this property contains a list of all constituent physical devices this virtual device is made of.

For physical devices, this returns an empty array.


position

readonly position: CameraPosition

The position of this camera on the device.


supportsDistortionCorrection

readonly supportsDistortionCorrection: boolean

Whether the CameraDevice supports distortion correction to correct stretched edges in wide-angle Cameras during Photo capture.

See

CapturePhotoSettings.enableDistortionCorrection


supportsExposureBias

readonly supportsExposureBias: boolean

Gets whether this CameraDevice supports biasing auto-exposure via setExposureBias(...).


supportsExposureLocking

readonly supportsExposureLocking: boolean

Gets whether this CameraDevice supports manual exposure via setExposureLocked(...).


supportsExposureMetering

readonly supportsExposureMetering: boolean

Gets whether this CameraDevice supports metering auto-exposure ('AE') via focusTo(...).


supportsFocusLocking

readonly supportsFocusLocking: boolean

Gets whether this CameraDevice supports manual focus via setFocusLocked(...).


supportsFocusMetering

readonly supportsFocusMetering: boolean

Gets whether this CameraDevice supports metering auto-focus ('AF') via focusTo(...).


supportsLowLightBoost

readonly supportsLowLightBoost: boolean

Whether this CameraDevice supports enabling low-light boost to improve exposure in dark scenes via CameraControllerConfiguration.enableLowLightBoost.

Example

await controller.configure({
  enableLowLightBoost: device.supportsLowLightBoost
})

supportsPreviewImage

readonly supportsPreviewImage: boolean

Returns true if this CameraDevice supports delivering preview Image instances before the actual Photo is available.

On iOS, this is always true.


supportsSmoothAutoFocus

readonly supportsSmoothAutoFocus: boolean

Gets whether this CameraDevice supports smoothly adjusting focus via CameraControllerConfiguration.enableSmoothAutoFocus.

Example

await controller.configure({
  enableSmoothAutoFocus: device.supportsSmoothAutoFocus
})

supportsSpeedQualityPrioritization

readonly supportsSpeedQualityPrioritization: boolean

Returns true if this CameraDevice supports capturing photos with the 'speed' QualityPrioritization.


supportsWhiteBalanceLocking

readonly supportsWhiteBalanceLocking: boolean

Gets whether this CameraDevice supports manual white-balance via setWhiteBalanceLocked(...).


supportsWhiteBalanceMetering

readonly supportsWhiteBalanceMetering: boolean

Gets whether this CameraDevice supports metering auto-white-balance ('AWB') via focusTo(...).


type

readonly type: DeviceType

The camera hardware type, for example 'wide-angle'.


zoomLensSwitchFactors

readonly zoomLensSwitchFactors: number[]

If this CameraDevice is a virtual device, this returns a list of zoom factors at which the virtual device may switch to another physical camera.

For physical devices, this returns an empty array.

Example

const camera = ...           // Triple-Camera (0.5x, 1x, 3x)
camera.zoomLensSwitchFactors // [1, 3]

Methods

hasMediaType()

hasMediaType(mediaType: MediaType): boolean

Returns true if this CameraDevice can stream to outputs of the given MediaType.

Example

Check if this device supports depth streaming:

const device = ...
const hasDepth = device.hasMediaType('depth')