-
Notifications
You must be signed in to change notification settings - Fork 181
feat: add configurability to just pause the scanner (while keeping the view open) on scan rather than destroying it. #33
Comments
I am planning on adding functionality that adds support for continuously scanning barcodes. So without even closing the camera view. It will then just return the values of barcodes it recognizes constantly. Is that something that works for you as well? |
I was hoping more for a "pause" in the scanner, i.e. the camera is still activated but not scanning, so I can show feedback that a barcode was scanned (a modal that pops up saying scanned over the camera viewfinder), and then after a set delay, the scanner will unpause and be able to scan barcodes again. |
Fair enough. Will look into it while developing continuous scanning mode. |
@tafelnl continuously scanning barcodes would be great and to @milanharia point it would be useful to have the ability to set a cool down time between scans (i.e how long before the scanner becomes active). Would also be useful to expose an event which can be used to distinguish between the scanning being 'active' or 'paused' to allow fine control over the UI overlay the user is shown between successful scans. |
@hellokingdom active/pause event is indeed essential I think. However I do think a cool down timer would be a little out of scope for this project. It wouldn't be to difficult to implement such a thing in JS however, with a simple timeout for example. |
@tafelnl Yeah that makes sense. If we have events for pausing and activating the scanner we can keep the UI logic in the JS layer where it belongs. |
Hi, any updates on this? :). I really need it. |
I have done that for Android. It is possible. Don't know if it's perfect but in my case it's working fine. Go to the method "Override public void barcodeResult(BarcodeResult barcodeResult)" and delete After that you can create a new method for scanning again.
After that create a new plugin method.
And the last step is to add the newly created method to the interface (capacitor-community\barcode-scanner\dist\esm\definitions.d.ts): And now you can start a new scan with "startScanAgain()". |
PR #93 which should resolve this by adding a continuous scanning feature is now merged to the main branch, I will make a few tests next week and release |
Right now the current implementation of the scanner is to automatically destroy it for battery and performance reasons. In the source code there is currently a destroy function which dismantles the camera and hides the viewfinder. It would be great if we could configure this functionality to just pause the scanner when a barcode is scanned, and to keep the camera viewfinder open, something like the function below.
private func destroy() {
self.shouldRunScan = false
}
The text was updated successfully, but these errors were encountered: