zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.

Home Page:https://zxing-js.github.io/library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

decodeFromVideoDevice return previous scanned result when no barcode is being scanned

mageshk98 opened this issue · comments

Describe the bug
decodeFromVideoDevice method returns the previously scanned barcode result and it never stops until I reset the scanner.

Code Reference
It's not the full code, hope this sufficient.

const [codeReader, setReader] = useState(
    new BrowserMultiFormatReader(null, 2000)
  );
  
async function startScanning() {
    codeReader.decodeFromVideoDevice(undefined, "videoElement", (res, err) => {
      if (res) {
        const rawText = res.getText();
        //handling res
      }
      if (err && !(err instanceof NotFoundException)) {
        console.error(err);
      }
    });
  }

Expected behavior
decodeFromVideoDevice callback should return currently scanned barcode result only not the previous one.

Screenshots
Screenshot 2022-11-02 at 8 33 56 AM

Desktop (please complete the following information):

  • OS: iOS 12.3.1
  • Browser chrome
  • Version 106.0.5249.119 (Official Build) (x86_64)