Open fydelio opened 4 years ago
You can continuously scan with the decodeFromInputVideoDeviceContinuously
, so no need to restart. Also, I would higly recommend switching to the new browser layer for better support and reliability: https://github.com/zxing-js/browser/releases/tag/v0.0.1-beta.1
Ok. I'll be looking forward to trying out the new scanner. Sorry, NooB question, by doing this
yarn add @zxing/library
would I then be getting the latest beta scanner?
Further: I checked the code of the beta release, the DecodeOnce no longer exists. So how could I temporarily stop the scanning after a positiv barcode read, to do an ajax request, and depending the result, tear down the scanner or do another scan using the latest build beta.1?
would I then be getting the latest beta scanner?
Yes, but only for this package. For the browser package please use yarn add @zxing/library @zxing/browser
.
Further: I checked the code of the beta...?
I think you're looking for decodeOnceFromVideoDevice
, the source is a bit changed indeed, hehe.
Hey Odahcam
Could you give some more background on how the library and the browser repository play together. Until now I only needed the library repository for the scanner to work, which included the browser files too.
So what exactly is the browser repo? An add on? Extension? That is not clear from the readme. Some context would be great.
Thx fydelio
Sure, the browser layer on the library is hard to maintain and develop and will be deleted. The browser package will then be the only browser layer available. The browser package already uses this library, is tested (while the layer here is not), is partialy documented (which currently is very poor here for the browser) and has a much better API and interaction with interface items.
I've been wanting to use the browser package instead of the library package, but I can't get the browser package to work while I can get the library package to work :/.
Ok I got decodeFromVideoDevice to work but couldn't get decodeOnceFromVideoDevice to work. I imagine I am just doing something wrong, but it would be great if the documentation could be improved.
How do I restart the Zxing-js 1/2D barcode scanner after a successful scan (best without dropping the video stream)?
I start my ZXing Multiformat Reader like this:
codeReader.decodeFromInputVideoDevice(undefined, 'video').then((result) => { ... I submit the value via AJAX to the backend, check the database and return the record if found } If no record is found, I show a message to the user and would like to restart the scanner. How to restart the scanner for a new scan?