Closed hoangnguyen208 closed 6 years ago
What you can do is open the web cam using a button and an event listener such as "click"
And you could delay creating the JSQR instance until the event is fired.
Or you could add an event listener to the last field such as "click or input" so the webcam would be open then.
So this would fall under our note on webcams - Specifically, jsQR is not designed specifically to work with a specific webcam setup, rather it's designed to work independently so that you can adapt to whatever your situation is.
That said, generally it comes down to when you read data from the webcam and send it to jsQR. For example in our demo we immediately ask for camera permissions and start capturing frames with the tick
function. it seems like in your case you'd want to do this once the user gets to that part of the form? This is what @chidonna is describing I believe.
If you have more questions about this I'd check out the resources mentioned in the note on webcams. I'm going to close this issue but if you believe that to be in error or have more questions feel free to re-open.
Hi, if I don't want the camera always shows, how can I toggle it off? Specifically, in my case, I have a form and decoding QR code is one of result I have to submit. QR code is the last field in the form I have to submit, so I want user to focus to fill all of the fields then toggle on the camera to get QR code before submitting the form. How can I achieve this feature?