zxing/library unable to scan UPC-E barcode

95 views Asked by At

zxing/library can't find the UPC-E barcode

 const hints = new Map()
 const formats = [
       BarcodeFormat.UPC_A,
       BarcodeFormat.UPC_E,
       BarcodeFormat.UPC_EAN_EXTENSION,
 ]

 hints.set(DecodeHintType.POSSIBLE_FORMATS, formats)

 const scanner = new BrowserMultiFormatReader(hints)
 const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'environment' }})
 const result = await scanner.decodeOnceFromStream(stream, 'video').catch(() => null)

It sucessfully scans UPC_A and UPC_EAN, but not the UPC_E

This is what I am trying to scan enter image description here

The library version is 0.20.0

I have tried on multiple devices, non of them succeeded

Do I have to do something special to make it work or the library has problems?

0

There are 0 answers