Camera Access

Defined under the namespace Scandit.Datacapture.Core

DeviceCamera
interface DeviceCamera

Added in version 6.13.0

A low-level camera object built from cameras found on the device.

deviceId
deviceId: string

Added in version 6.13.0

The camera device id

position
position: CameraPosition

Added in version 6.13.0

The type (facing mode/direction) of camera: back (environment) or front (user). Not guaranteed to be correct: depending on device, browser and camera it could not correspond to the camera’s real type.

label
label: string

Added in version 6.13.0

The label describing the device.

getCameras(refreshDevices, cameraAlreadyAccessed)
function getCameras(refreshDevices?: boolean,
        cameraAlreadyAccessed?: boolean): Promise<DeviceCamera[]>

Added in version 6.13.0

Param [refreshDevices]

Force a call to refresh available video devices even when information is already available, defaults to false

Param [cameraAlreadyAccessed]

Hint that a camera has already been accessed before, avoiding a possible initial camera access permission request on the first call, in cases this cannot be already reliably detected, defaults to false

Get a list of cameras (if any) available on the device, a camera access permission is requested to the user the first time this method is called if needed.

If the browser is incompatible the returned promise is rejected with a UnsupportedBrowserError error.

When refreshing available devices, if updated deviceId information is detected, cameras’ deviceId are updated accordingly. This could happen after a camera access and stop in some situations.