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

Race condition when the reset function is being called shortly after calling decodeOnceFromVideoDevice()

purquijo opened this issue · comments

While using the BrowserCoderReader, if the reset function is invoked shortly after calling decodeOnceFromVideoDevice(), it occurs before the initialization of the variable this.stream. Consequently, the streams are inadequately terminated (stopStreams()), leading to the persistence of the camera being active. Is there a solution to this issue? If this.stream is initialized at the beginning, the problem should be resolved.

@purquijo maybe try to use decodeFromConstraints(). I had something similar, but I decided to continuously scan it.

@gyto23 I've used decodeOnceFromStream()and handled the stopping of the streams manually.