Create a new BarcodeReader using a Configuration object.
A configuration object.
This will perform some basic checks, such as if the SDK was initialized, the browser supports the required APIs and the host element is visible and has a non-zero size. This will not access the camera yet, that happens in the BarcodeReader#initialize method.
Optional
detectedUser-supplied barcode detection handler.
This is a synchronous call, so further processing will not happen until the handler returns.
Optional
onOptional user-supplied error callback.
This is invoked by the BarcodeReader if an error occurred while processing frames, and is usually not recoverable.
Destroy this BarcodeReader instance, making it unusable.
Promise that resolves when the BarcodeReader and its associated resources are fully destroyed.
This will release all associated resources, including the camera stream, and should be called whenever an application no longer needs the BarcodeReader.
Initialize the BarcodeReader instance.
A promise resolving to an initialized BarcodeReader instance, or an SdkError object.
This will attempt to acquire a camera stream, so it is essential that the returned Promise is awaited, and that measures are taken so that the returned BarcodeReader instance is destroyed when it is no longer need. That will free the camera stream for subsequent use.
If you are getting camera-related initialization errors, the most likely cause is that you are attempting to initialize a BarcodeReader and the camera feed has not been released yet.
Start barcode recognition.
The BarcodeReader instance must have previously been successfully initialized using the BarcodeReader#initialize method.
Stop barcode recognition.
This will suspend camera frame processing/barcode recognition, but will not release the camera stream. If you no longer intend to use the BarcodeReader instance, call BarcodeReader#destroy afterward.
If you intend to only temporarily stop recognition of barcodes and resume later, call BarcodeReader#start again.
BarcodeReader is the primary interface of the STRICH SDK.