Comments (4)
stopScanning()
is a promised based API and may not be instantaneous as it needs to cleanup - on going video stream and scanning.
Would this way help
if(qrCodeMessage == matchingPattern) {
resultBox.innerHTML = qrCodeMessage; // my test-div
setTimeout(function() {
// Some UI transitions indicating stopping
stopScanning()
.then(_ => {
// UI changes for fully stopped
})
.catch(error => {
// Error UI or fallbacks
})
}, timeoutAfterScan);
}
from html5-qrcode.
@OneDivZero is this still happening?
from html5-qrcode.
Marking closed, @OneDivZero - Please feel free to reopen if this is still happening.
from html5-qrcode.
Dears, sorry for reopening. I have similar/related problem that I kindly desire some guidance on, pretty please!
Using html5QrCode 2.0.3, in my qrCodeSuccessCallback.. I am immediately calling html5QrCode.stop() using await and then reactivating it once done with parsing logic.. this works great (visible in code below).
However, I'd like to keep camera off for X seconds (so user can verify parse data before next scan) so I wrapped my call to startScanning() inside setTimeout, but when I do.. I randomly receive this error:
Uncaught (in promise) Cannot clear while scan is ongoing, close it first.
I'm confident the scanner is stopped before calling startScanning (in both working/non-working scenarios).. I just don't understand how SetTimeout introduces the error.
Thank you kindly for the library, and your insight.
function startScanning() { html5QrCode.start({facingMode: "environment"}, { fps: 10}, async qrCodeMessage => { await stopScanning(); //parse & display logic here //startScanning(); //this works, camera re-activates really fast setTimeout(function () { //but if I use this instead, it randomly errors on next scan.. regardless of interval startScanning(); }, 100); //errors occur at 100ms, 3000ms, 10000ms }, errorMessage => {}).catch(err => { console.log(err); }); }
from html5-qrcode.
Related Issues (20)
- Compatibility Issue - [iOS 17.2.3] [Safari] - Only black screen is visible once camera permission is given. HOT 1
- Unable to scan PDF-417 barcode HOT 3
- Add ability to take a screenshot of barcode with the device's camera
- Barely functioning in iOS. Perfect in Android. QR recognition script or app? HOT 10
- Compatibility - iOS 17 - All browsers - Rear camera is not working HOT 1
- Turn off file upload HOT 5
- Compatibility - [OS] [Browser] - NotAllowedError: Permission denied HOT 9
- Problem with turning off barcode scanning when the browser is closed or the browser goes to the background on mobile
- Adjusting the Camera Resolution for Flutter Web App HOT 10
- Camera closed after each succesful scan. HOT 2
- [Feature Request] Angular 16 framework support for this library HOT 4
- Barcode scanner outputs the barcode value with junc characters in between
- Set the position of qrbox in top using camera with full screen
- Barcode 39 is scanned unreliably on Android HOT 1
- setTimout violation problem
- Not scanning white barcodes
- [Feature Request] Make it easier to override this package with local changes.
- QR-code image scanning feature get Bug !
- iphone error: undefined is not an object HOT 1
- Compatibility - [IOS] [Chrome , Safari] - Iphones aren't reading barcode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html5-qrcode.