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.
- 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.
- 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 user denies the necessary camera access permission, a list of cameras with the correct amount of devices is returned in any case, but the cameras will have no available (empty) label and deviceId and can thus not be accessed.
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.