Sindbad~EG File Manager

Current Path : /home/numerotech/conf-regdesk.numerotech.com/reg_desk/core/static/js/
Upload File :
Current File : //home/numerotech/conf-regdesk.numerotech.com/reg_desk/core/static/js/qrcode-scanner.js

$(document).ready(function() {
    const video = document.getElementById('video');
    const canvasElement = document.getElementById('canvas');
    const canvas = canvasElement.getContext('2d');
    const outputData = document.getElementById('qr-result');

    // Access the device camera and stream to video element
    navigator.mediaDevices.getUserMedia({ video: { facingMode: "environment" } }).then(function(stream) {
        video.srcObject = stream;
        video.setAttribute("playsinline", true); // required to tell iOS safari we don't want fullscreen
        video.play();
        requestAnimationFrame(tick);
    });

    function tick() {
        if (video.readyState === video.HAVE_ENOUGH_DATA) {
            canvasElement.height = video.videoHeight;
            canvasElement.width = video.videoWidth;
            canvas.drawImage(video, 0, 0, canvasElement.width, canvasElement.height);
            const imageData = canvas.getImageData(0, 0, canvasElement.width, canvasElement.height);
            const code = jsQR(imageData.data, imageData.width, imageData.height, {
                inversionAttempts: "dontInvert",
            });
            if (code) {
                outputData.innerText = code.data;
            }
        }
        requestAnimationFrame(tick);
    }
});

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists