CameraDevice
interface CameraDevice extends HybridObjectThe 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?
readonly optional companionDeskViewCamera: CameraDeviceThe matching Desk View camera for this Continuity Camera, if available.
focalLength?
readonly optional focalLength: numberReturns 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: booleanWhether 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: booleanWhether 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: stringA unique identifier for this camera device.
isContinuityCamera
readonly isContinuityCamera: booleanReturns true if this camera is a Continuity Camera.
On non iOS platforms this is always false.
isVirtualDevice
readonly isVirtualDevice: booleanGets 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: numberThe size (ƒ number) of the lens diaphragm.
localizedName
readonly localizedName: stringA user friendly camera name shown by the system.
manufacturer
readonly manufacturer: stringThe hardware manufacturer name for this device.
maxExposureBias
readonly maxExposureBias: numberGets the maximum supported value for
the exposure bias (in EV units), or 0
if supportsExposureBias is false.
maxWhiteBalanceGain
readonly maxWhiteBalanceGain: numberThe maximum value a single color-channel can be
set to in WhiteBalanceGains.
maxZoom
readonly maxZoom: numberThe 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: numberGets the minimum supported value for
the exposure bias (in EV units), or 0
if supportsExposureBias is false.
minZoom
readonly minZoom: numberThe minimum supported zoom value.
modelID
readonly modelID: stringThe 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: CameraPositionThe position of this camera on the device.
supportsDistortionCorrection
readonly supportsDistortionCorrection: booleanWhether the CameraDevice supports
distortion correction to correct stretched edges
in wide-angle Cameras during Photo capture.
See
CapturePhotoSettings.enableDistortionCorrection
supportsExposureBias
readonly supportsExposureBias: booleanGets whether this CameraDevice
supports biasing auto-exposure via
setExposureBias(...).
supportsExposureLocking
readonly supportsExposureLocking: booleanGets whether this CameraDevice
supports manual exposure via
setExposureLocked(...).
supportsExposureMetering
readonly supportsExposureMetering: booleanGets whether this CameraDevice
supports metering auto-exposure ('AE')
via focusTo(...).
supportsFocusLocking
readonly supportsFocusLocking: booleanGets whether this CameraDevice
supports manual focus via
setFocusLocked(...).
supportsFocusMetering
readonly supportsFocusMetering: booleanGets whether this CameraDevice
supports metering auto-focus ('AF')
via focusTo(...).
supportsLowLightBoost
readonly supportsLowLightBoost: booleanWhether 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: booleanReturns true if this CameraDevice supports
delivering preview Image instances before
the actual Photo is available.
On iOS, this is always true.
supportsSmoothAutoFocus
readonly supportsSmoothAutoFocus: booleanGets whether this CameraDevice
supports smoothly adjusting focus via
CameraControllerConfiguration.enableSmoothAutoFocus.
Example
await controller.configure({
enableSmoothAutoFocus: device.supportsSmoothAutoFocus
})supportsSpeedQualityPrioritization
readonly supportsSpeedQualityPrioritization: booleanReturns true if this CameraDevice supports
capturing photos with the 'speed'
QualityPrioritization.
supportsWhiteBalanceLocking
readonly supportsWhiteBalanceLocking: booleanGets whether this CameraDevice
supports manual white-balance via
setWhiteBalanceLocked(...).
supportsWhiteBalanceMetering
readonly supportsWhiteBalanceMetering: booleanGets whether this CameraDevice
supports metering auto-white-balance ('AWB')
via focusTo(...).
type
readonly type: DeviceTypeThe 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): booleanReturns 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')