zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.

Home Page:https://zxing-js.github.io/library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

camera loads slower than the wrapper div loads if using function button like "document.getElementById(id).addEventListener("click", function() {} to open the camera

Jonnas123 opened this issue · comments

commented

If I use MultiReader.reset(); to close the camera automatically when the scan complates and then click the Start Scan button again that has this function document.getElementById("open").addEventListener("click", function() {}, it seems that the camera loads slower than the wrapper div loads. The wrapper div loads first and then the camera loads.

However, without the function above, the camera loads immediately, at the same time the wrapper div loads. This is what I want but it will leave the camera open as I can see in my push notification "A site is using your camera".

Any suggestion to reset the camera but open the camera (immeditaly) at the same time the wrapper div loads when the button is clicked?