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

Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.

jinxiaochi opened this issue · comments

Describe the bug
I wirite a modal to scan the barcode, and it is close when it finish.
I write the code base on the project exam, that is multi-camera
But when the modal is close, the program report a bug below:

index.js:56 DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.

image

To Reproduce
I looking for the trace stack, and find it cause by BrowserMultiFormatReader.decodeContinuously. I guess it changes the status of _stopContinuousDecode incorrectly by go through the source code roughly.

Here is my change:

image

Expected behavior
But I do not know if I was right to change the code, or the proceess of reset _stopContinuousDecode is necessary in other aspects.
The method seems important in the project, so I dare not to make a pull request.

Thanks to anynone for answering my question, and I feel little nervous when first time make a Issue.

Desktop (please complete the following information):

  • OS: windows 10
  • Browser Chrome
  • Version 115.0.5790.110
  • other:Chrome Mobile phone simulator for Iphone SE.