-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to stop the reader and turn off the camera #21
Comments
There isn't a way for doing that! Why? Because I designed it for being stopable by Prosime cancellation, but then I discovered that in JS there isn't such API. (...) Here's how it's written by now: browser/src/readers/BrowserCodeReader.ts Lines 965 to 999 in 90929d6
So... I would say you should use the continuously decoding APIs for having full control over tha scanning proccess. |
Related to #17 |
@odahcam - Thanks. I've since removed all async/await items. Stopped the camera dying, but now being killed by the TypeError. I've also since moved over to the BrowserMultiFormatReader to read PDF417 and it seems less brittle - no idea why.. |
Yeah, that is a PDF417 Reader error, I think we should move this conversation to #23 then. |
Now there is the AbortController, but might not work everywhere |
Nice, I think we can do similar implementation in here. |
Althoug I never liked the AbortController, just |
It was a bad design, hard to maintain and father of many bugs, it won't come back. Instead we will create a simpler and elegant solution for this. When I have some free time, of course, or some kind soul sends a PR. |
Could we reopen this issue ? It's still a problem and I assume it can be implemented via abortController :) |
Using: "@zxing/browser": "0.0.5"
Codebase: TypeScript project using lit-element
Hello,
I'm trying to implement this
browser
version of the library in a small UI to scan PDF417 barcodes.I am having a hard time understanding how to stop listening/scanning/reading and turning the camera off.
In the /library version I see I can call stop() on the reader, though it doesn't appear to be available in this browser version for both types of VideoDevice decodes.
These pieces of code are lifted from the overall solution I'm trying to build.
In this first snippet I'm trying to decode once.
In this case, how can I stop the stream and turn off the camera - like a reset
In the DecodeContinously I can grab controls to stop the stream. I can now call
this.controls.stop()
How to we properly turn off the camera and stop listening in the decodeOnce version?
The text was updated successfully, but these errors were encountered: