This sample demonstrates how to use the BarcodeScanner API from the Dynamsoft Barcode Reader JavaScript SDK with ES6 modules to scan a single barcode using the camera.
- Easy integration with pre-built UI using ES6 module imports
- BarcodeScanner instance with minimal configuration
- Scans one barcode at a time from video
- Uses native ES6 module syntax for clean, modern code
Open es6.html in a web browser (via http:// or https:// protocol, not file://).
import { BarcodeScanner } from "https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/dbr.bundle.mjs";let config = {
license: "YOUR-LICENSE-KEY",
container: document.querySelector(".barcode-scanner-view"),
uiPath: "https://cdn.jsdelivr.net/npm/dynamsoft-barcode-reader-bundle@11.2.4000/dist/ui/barcode-scanner.ui.xml",
engineResourcePaths: {
rootDirectory: "https://cdn.jsdelivr.net/npm/",
},
};
const barcodeScanner = new BarcodeScanner(config);
let result = await barcodeScanner.launch();Please check the official documentation.
If you have any questions, feel free to contact Dynamsoft Support.