This page is applicable to version 8.2.3
Javascript API Reference - BarcodeScanner
Accessors
Accessors | Description |
---|---|
defaultUIElementURL | Get or set the default scanner UI. |
singleFrameMode | If set to true , single video frames will be used instead of a continuous video stream. |
soundOnSuccessfulRead | Get or set the sound to play when a barcode is read successfully. |
Inherited Accessors from BarcodeReader
Accessors | Description |
---|---|
engineResourcePath | Get or set the engine (WASM) location. |
productKeys | Get or set the Dynamsoft Barcode Reader SDK product keys. |
version | Get current version. |
defaultUIElementURL
Get or set the default scanner UI. The default scanner UI is defined in the file dist/dbr.scanner.html
. Follow these steps to customize the UI.
defaultUIElementURL = 'url'
Property Value
url
string
Tips and Tricks
- Be sure to set
defaultUIElementURL
before you callcreateInstance
.
singleFrameMode
Get or set the camera mode. If true
, single video frames will be used instead of a continuous video stream. It’s especially useful for cameras that lack webcam access (lack of WebRTC support, e.g. Chrome on iOS).
singleFrameMode = bool;
Property Value
bool
boolean
Sample
let scanner = await Dynamsoft.BarcodeScanner.createInstance();
scanner.singleFrameMode = true; // use singleFrameMode anyway
scanner.show();
Tips and Tricks
-
singleFrameMode
is based on WebRTC support, not actual camera connection. In other words, if a browser supports WebRTC, it won’t be usingsingleFrameMode
by default even when there is no camera attached. -
By default, when the default UI is used, a camera icon will appear for the
singleFrameMode
which is defined by a SVG (className
isdbrScanner-bg-camera
). If you have customized the UI, you will have to provide your own UI implementation for this mode.
soundOnSuccessfulRead
Get or set the sound played when a barcode is read successfully.
soundOnSuccessfulRead = audio
Property Value
audio
HTMLAudioElement
Sample
scanner.soundOnSuccessfulRead = new Audio("./pi.mp3");