Interface FrameSourceConfiguration

Configuration for the frame source (camera).

interface FrameSourceConfiguration {
    constraints?: MediaStreamConstraints;
    rememberCameraDeviceId?: boolean;
    resolution?: "hd" | "full-hd" | "auto";
}

Properties

constraints?: MediaStreamConstraints

Allow passing in exact constraints for camera device selection via getUserMedia. If set, will override the FrameSourceConfiguration.resolution property and any other camera-related properties.

Example

In the example below, a camera device is explicitly selected by ID. Audio is explicitly not requested (never used by STRICH) and an HD-like resolution preference is specified by range.

constraints: {
video: {
deviceId: {
exact: '2d122f8e0630b5a6a19c157f066e13e05115f12f7d4dfb29e5560b4acefe7308'
},
width: {min: 800, ideal: 1280, max: 1600},
height: {min: 600, ideal: 720, max: 900}
},
audio: false
}

Remarks

This is an advanced option, and should only be used if you are familiar with the Media Capture and Streams API and have to build your own camera selection workflow.

Default Value

undefined
rememberCameraDeviceId?: boolean

Remember the camera that was last used to successfully scan a code.

Remarks

If this is set to true, the frame source will remember the camera used whenever a code was successfully scanned, and attempt to use the same camera again when re-initialized.

Default Value

false
resolution?: "hd" | "full-hd" | "auto"

Video frame resolution.

Remarks

The default resolution is 720p, which is usually enough for good quality barcodes. You can try higher resolutions if you have very fine or degraded codes, at the expense of higher computational requirements.

Default Value

hd

Generated using TypeDoc