Comments (13)
The bug is reproduced. QrScanner component doesn't present in DOM, but camera is still working. tracker={false} doesn't affect anything.
from react-qr-scanner.
I'm not able to replicate this issue in Chrome or Safari. Could you provide an example with the issue?
I took a video and uploaded it on YouTube. Here's the link: https://www.youtube.com/watch?v=D9boAG1DInY
(you should look at the webcam LED status on the laptop. It doesn't turn off even after I go back. And the QrScanner is actually working at that moment.)
from react-qr-scanner.
I am getting this console error on unmount of QRScanner
container component.
DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.
at e2.makeBufferFromCanvasImageData (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1354:34)
at new e2 (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1351:72)
at t2.createBinaryBitmap (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1877:46)
at t2.decode (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1873:19)
at n2 (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1865:23)
Just before this error I also get some warnings like this:
BrowserCodeReader.js:527 It was not possible to play the video.
and
BrowserCodeReader.js:515 Trying to play video that is already playing.
from react-qr-scanner.
Could you provide a code sandbox with the issue on hand?
After QrScanner
is unmounted it will not exist anymore in the dom.
from react-qr-scanner.
By providing tracker={false}
property to the QRScanner component, it solved the problem. Thanks for your fast reply.
from react-qr-scanner.
I'm having the same problem. But in my case, if I try to go back in the browser before the QrScanner component loads the video (or perhaps the camera device) completely, the camera device still works. So, I need to refresh the entire website to turn off it. (Interestingly, it works well in FireFox)
from react-qr-scanner.
@yoonh12 yes. right. It keeps on scanning under the hood unless we refresh the browser or unmount the component. Or after successful scan, you can turn the camera off by just providing tracker={false}
property in the QRScanner component.
from react-qr-scanner.
@yoonh12 yes. right. It keeps on scanning under the hood unless we refresh the browser or unmount the component. Or after successful scan, you can turn the camera off by just providing
tracker={false}
property in the QRScanner component.
I've already gave that prop but it didn't help.
from react-qr-scanner.
I'm not able to replicate this issue in Chrome or Safari. Could you provide an example with the issue?
from react-qr-scanner.
The bug is reproduced. QrScanner component doesn't present in DOM, but camera is still working. tracker={false} doesn't affect anything.
Yes. I really want to fix this bug. but I don't know how :(
from react-qr-scanner.
Can you add a button for start and stop scanning or give us an api to implement it, to start the camera and stop it whenever we require it ... like in html5-qrcode, that feature could solve the issue
edit: oh sorry, tracker is the prop to handle that ... thanks
from react-qr-scanner.
I am getting this console error on unmount of
QRScanner
container component.DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0. at e2.makeBufferFromCanvasImageData (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1354:34) at new e2 (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1351:72) at t2.createBinaryBitmap (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1877:46) at t2.decode (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1873:19) at n2 (http://192.168.68.110:3000/node_modules/.vite/deps/@yudiel_react-qr-scanner.js?v=687bf47f:1865:23)
Just before this error I also get some warnings like this:
BrowserCodeReader.js:527 It was not possible to play the video.
and
BrowserCodeReader.js:515 Trying to play video that is already playing.
I'm getting this too BrowserCodeReader.js:515 Trying to play video that is already playing.
after trying to turn back on the camera after turning it off with tracker={false}, which means it was already on
from react-qr-scanner.
Could you try it using localhost
or https
. By your error I see that you are using http.
from react-qr-scanner.
Related Issues (12)
- Cannot find module '@yudiel/react-qr-scanner' or its corresponding type declarations. HOT 2
- Request for Documentation: Details on Errors HOT 1
- Large chunks when using with Vite
- How to close the QrScanner properly once we got the result ? HOT 4
- Feature request: Allow to enable the torch on the ImageCapture HOT 1
- Camera Stream Continues After Modal Closure Due to Premature Unmount HOT 8
- Feature request - Pause reading HOT 2
- QR code not scanning HOT 1
- Failed to parse source map from warnings HOT 11
- "Could not start video source" error on Android 7 and Chrome 109 HOT 2
- Flip the camera preview image when needed HOT 2
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 react-qr-scanner.