Try to apply new settings to the currently used camera for video input, if no settings are passed the default ones are set.
Depending on device features and user permissions for camera access, any of the following errors could be the rejected result of the returned promise:
The new camera options used when accessing the camera, by default HD resolution is used.
A promise resolving to the updated BarcodePicker object when the camera is updated.
Applies a new set of scan settings to the internal scanner (replacing old settings).
The scan configuration object to be applied to the scanner.
The updated BarcodePicker object.
Stop scanning and displaying video output, remove HTML elements added to the page, destroy the internal Scanner and destroy the barcode picker itself; ensuring complete cleanup.
This method should be called after you don't plan to use the picker anymore, before the object is automatically cleaned up by JavaScript. The barcode picker must not be used in any way after this call.
The currently active camera.
Whether the camera video is mirrored along the vertical axis.
Whether a sound should be played on barcode recognition (iOS requires user input).
Whether the barcode picker has loaded the external Scandit Engine library and is ready to scan.
Whether the scanning is currently paused.
Whether the device should vibrate on barcode recognition (only Chrome & Firefox, requires user input).
Whether the picker is in a visible state or not.
Add the listener function to the listeners array for the "ready" event, fired when the external Scandit Engine library has been loaded and the barcode picker can thus start to scan barcodes.
No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.
The listener function.
The updated BarcodePicker object.
Add the listener function to the listeners array for the "scan" event, fired when new barcodes are recognized in the image frame. The returned barcodes are affected by the ScanSettings.setCodeDuplicateFilter option.
No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.
The listener function, which will be invoked with a ScanResult object.
Whether the listener should just be triggered only once and then discarded.
The updated BarcodePicker object.
Add the listener function to the listeners array for the "scan error" event, fired when an error occurs during scanning initialization and execution. The barcode picker will be automatically paused when this happens.
No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.
The listener function, which will be invoked with an ScanditEngineError object.
Whether the listener should just be triggered only once and then discarded.
The updated BarcodePicker object.
Pause the recognition of codes in the input image, video from the camera is still shown.
The updated BarcodePicker object.
Removes the specified listener from the "scan error" event listener array. This will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times then this method must be called multiple times to remove each instance.
The listener function to be removed.
The updated BarcodePicker object.
Removes all listeners from the "scan error" event listener array.
The updated BarcodePicker object.
Removes the specified listener from the "scan" event listener array. This will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times then this method must be called multiple times to remove each instance.
The listener function to be removed.
The updated BarcodePicker object.
Removes all listeners from the "scan" event listener array.
The updated BarcodePicker object.
Resume the recognition of codes in the input image.
The updated BarcodePicker object.
Select a camera to be used for video input.
Depending on device features and user permissions for camera access, any of the following errors could be the rejected result of the returned promise:
The new camera to be used.
The camera options used when accessing the camera, by default HD resolution is used.
A promise resolving to the updated BarcodePicker object when the camera is set.
Enable or disable camera video mirroring along the vertical axis.
Whether the camera video is mirrored along the vertical axis.
The updated BarcodePicker object.
Enable or disable playing a sound on barcode recognition (iOS requires user input).
Whether a sound should be played on barcode recognition.
The updated BarcodePicker object.
Enable or disable the torch/flashlight of the device (when available, only Chrome). Changing active camera or camera settings will cause the torch to become disabled.
A button on the BarcodePicker UI to let the user toggle this functionality can also be set on creation via the enableTorchToggle option (enabled by default, when available).
Whether the torch should be enabled or disabled.
The updated BarcodePicker object.
Enable or disable vibrating the device on barcode recognition (only Chrome & Firefox, requires user input).
Whether the device should vibrate on barcode recognition.
The updated BarcodePicker object.
Enable or disable picker visibility.
Whether the picker is in a visible state or not.
The updated BarcodePicker object.
Creates a BarcodePicker instance, creating the needed HTML in the given origin element and accessing the camera, a camera access permission is requested to the user if needed. This object expects that at least a camera is available. The active camera is accessed and kept active during the lifetime of the picker (also when hidden or scanning is paused), and is only released when destroy is called.
It is required to having configured the library via configure before this object can be created.
Depending on parameters, device features and user permissions for camera access, any of the following errors could be the rejected result of the returned promise:
The HTMLElement inside which all the necessary elements for the picker will be added.
A promise resolving to the created ready BarcodePicker object.
Generated using TypeDoc
A barcode picker element used to get and show camera input and perform scanning operations.
The barcode picker will automatically fit and scale inside the given originElement.
Each barcode picker internally contains a Scanner object with its own WebWorker thread running a separate copy of the external Scandit Engine library. To optimize loading times and performance it's recommended to reuse the same picker and to already create the picker in advance (hidden) and just display it when needed whenever possible.
As the loading of the external Scandit Engine library can take some time the picker always starts inactive (but showing UI and video) and then activates, if not paused, as soon as the library is ready to scan. The onReady method can be used to set up a listener function to be called when the library is loaded.
You are not allowed to hide the Scandit logo present in the corner of the UI.