{ selectedDeviceId = videoInputDevices.deviceId; codeReader.decodeFromVideoDevice(selectedDeviceId, 'barcode-scanner', { formats: [ZXing.BarcodeFormat.EAN_13] }, (result, err) => { if (result) { console.log('Barcode detected:', result); document.getElementById('scannedBarcodeLabel').innerText = `Scanned Barcode: ${result.text}`; handleScannedBarcode(result.text); } if (err && !(err instanceof ZXing.NotFoundException)) { console.error('Error:', err); } }); document.getElementById('scanNowButton').style.display = 'block'; }) .catch(err => console.error('Error listing video input devices:', err)); }); document.getElementById('scanNowButton').addEventListener('click', () => { codeReader.decodeOnceFromVideoDevice(selectedDeviceId, 'barcode-scanner', { formats: [ZXing.BarcodeFormat.EAN_13] }) .then(result => { if (result) { console.log('Barcode detected:', result); document.getElementById('scannedBarcodeLabel').innerText = `Scanned Barcode: ${result.text}`; handleScannedBarcode(result.text); } }) .catch(err => { if (err && !(err instanceof ZXing.NotFoundException)) { console.error('Error:', err); } }); }); document.getElementById('resetButton').addEventListener('click', () => { codeReader.reset(); document.getElementById('scannedBarcodeLabel').innerText="Scanned Barcode: None"; document.getElementById('productDetailsLabel').innerText="Product Details: None"; document.getElementById('scanNowButton').style.display = 'none'; }); // Function to handle the scanned barcode function handleScannedBarcode(barcode) {…" />
October 22, 2024
Chicago 12, Melborne City, USA
javascript

zxing-js refuses to scan barcodes


@model Pocos.MCD_Stores

@{
    ViewBag.Title = "DoVisit";
}


Do Visit




You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video