Constructor
new Scanner()
Methods
getPreferredScannerId()
Returns back camera id (if found). If only single camera is available, returns that instead
getScanners() → {Array.<MediaDeviceInfo>}
Returns a list of video devices scanned. initScanners() should have been invoked before this method is called
Returns:
list of available video devices
- Type
- Array.<MediaDeviceInfo>
handleError(message)
Displays error message on the UI
Parameters:
Name | Type | Description |
---|---|---|
message |
Error | error message to be shown |
initScanners() → {Promise}
Reads up and validates available cameras and features
Returns:
resolves if media devices are supported and cameras exist, rejects otherwise
- Type
- Promise
renderUi(messageopt)
Initializes modal with video element
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
String |
<optional> |
message to be displayed in the modal |
scan(scannerId) → {Promise.<(void|never)>}
Parameters:
Name | Type | Description |
---|---|---|
scannerId |
string | id of camera device that should be used for scanning |
Returns:
- Type
- Promise.<(void|never)>
startScanning()
Initializes scanning. Create modal, starts camera etc.
stopScanning()
Stops scanning, closes scanner, modal