'QR code scanner using HTML5-QRCODE Library

I am using the following code to develop a qrcode scanner(source : https://github.com/mebjas/html5-qrcode)


            console.log('Code matched = ${decodedText}', decodedResult);
            document.getElementById("abs_name").value = decodedText;

            html5QrcodeScanner.clear();

        }

        function onScanFailure(error) {
            // handle scan failure, usually better to ignore and keep scanning.

            console.warn('Code scan error = ${error}');
        }

        let html5QrcodeScanner = new Html5QrcodeScanner(
            "reader",
            { fps: 10, qrbox: { width: 250, height: 250 } },
    /* verbose= */ false);

        html5QrcodeScanner.render(onScanSuccess, onScanFailure);

Its working perfectly fine except for one thing. It asks for camera permissions only for the first time I open it in any device and for the next subsequent times when I open it from the same device, it remembers the camera preferences for that device, opens the camera without asking for permissions and starts scanning. This is not advisable when using for business purpose.

I want the scanner to ask for camera permissions each and every time it is used.

Please let me know if there is a way to achieve the above functionality using this HTML5-qrcode library.

Thank you



Solution 1:[1]

let html5QrcodeScanner = new Html5QrcodeScanner("reader", {
  fps: 60,
  qrbox: {width: 250, height: 250},
  rememberLastUsedCamera: false
});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adrian Mole