Estoy tratando de trabajar con https://github.com/mebjas/html5-qrcode donde una vez que escanee algo, el resultado se completará en el campo de entrada id "salida". Sin embargo, la salida no se completa en la identificación de salida.
var html5QrcodeScanner = new Html5QrcodeScanner( "qr-reader", { fps: 10, qrbox: 250 }); function onScanSuccess(decodedText, decodedResult) { // Handle on success condition with the decoded text or result. console.log(`Scan result: ${decodedText}`, decodedResult); // ... //html5QrcodeScanner.clear(); // ^ this will stop the scanner (video feed) and clear the scan area. } //Modification Attempt starts here let QrResult = function(onCloseCallback) { let scanResultParsed = document.getElementById("output"); } QrResult.onScanSuccess = function(decodedText) { this.__onScanSuccess(decodedText); } html5QrcodeScanner.render(onScanSuccess); function onScanSuccess(decodedText, decodedResult) { console.log(decodedText, decodedResult); if (html5QrcodeScanner.getState() !== Html5QrcodeScannerState.NOT_STARTED) { html5QrcodeScanner.pause(/* shouldPauseVideo= */ true); } let scanType = "camera"; if (html5QrcodeScanner.getState() === Html5QrcodeScannerState.NOT_STARTED) { scanType = "file"; } qrResultHandler.onScanSuccess(decodedText, decodedResult, scanType); } html5QrcodeScanner.render(onScanSuccess); <script src="https://github.com/mebjas/html5-qrcode/releases/download/v2.1.6/html5-qrcode.min.js"></script> <body> <div id="qr-reader"></div> <div id="qr-reader-results"> <input id="output" name="output" type="text" readonly="readonly"> </div>¿Qué tal algo como
let outputContainer = document.getElementById('output'); var html5QrcodeScanner = new Html5QrcodeScanner( "qr-reader", { fps: 10, qrbox: 250 }); function onScanSuccess(decodedText, decodedResult) { // Handle on success condition with the decoded text or result. console.log(`Scan result: ${decodedText}`, decodedResult); outputContainer.value = decodedText; } html5QrcodeScanner.render(onScanSuccess);