Good tutorial.I am loading this in webview for android app.But the cam is not opened for QR code.It triggers error.Also the qr code image path is not loaded. Any idea?
@@kovereduard637 yes actually applied some changes but i cant provide the modified code cause i am using it in my company's project....... sorry for that
It seems there isn't a simple solution for doing that at the moment beyond styling the UI that is injected with CSS. However, if you are willing to write a bit more code, for now you could wait for the particular element you want to exist (e.g. change a label for) using the MutationObserver and then modify it. It is a bit of a workaround in terms of intercepting elements rather than modifying them within the library but it seems like the best solution for now. In case you are unfamiliar with it, here s a basic introduction: ruclips.net/video/onzJwmACYAc/видео.html
hello. Thanks for the good solution. Is it possible to communicate with the server by binding data to QR code? Is it possible to scan the QR code and display a modal window rather than a results page? I've been thinking about solving this problem for several days.
Is there any way to upload image as an identification card with a qr-code in it and scan it ? I tried it right now it doesn't recognize the qr-code in it
Technically, this should be possible as long as the QR code is visible next to whatever else is on the ID card (as long as it's not another code). A possible option for increasing the chances of it scanning successfully is to increase the 'fps' value (frames per second) for detecting a code in the options object. This will mean it attempts to read the code more often but can start affecting perforance is you set it too high (a value up to 1000 is possible according to the docs). If there is some other code on the card and you want to limit it, you can add this property to the options object to limit detection to QR codes only: formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ]
HTML Element with id=reader not found at handleError (localhost:4200/static/js/bundle.js:334531:58) at localhost:4200/static/js/bundle.js:334550:7 at Object.invokeGuardedCallbackDev (localhost:4200/static/js/bundle.js:293939:20) at invokeGuardedCallback (localhost:4200/static/js/bundle.js:293996:35) at reportUncaughtErrorInDEV (localhost:4200/static/js/bundle.js:309929:9) at captureCommitPhaseError (localhost:4200/static/js/bundle.js:313591:9) at commitPassiveMountEffects_complete (localhost:4200/static/js/bundle.js:311658:13) at commitPassiveMountEffects_begin (localhost:4200/static/js/bundle.js:311646:11) at commitPassiveMountEffects (localhost:4200/static/js/bundle.js:311636:7) at flushPassiveEffectsImpl (localhost:4200/static/js/bundle.js:313519:7) i'm getting this error
Hello! am i the only one who gets 23 warnings like this one: WARNING in ./node_modules/html5-qrcode/esm/zxing-html5-qrcode-decoder.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from 'C:\Users\Juani\Desktop\StockScan\client ode_modules\src\zxing-html5-qrcode-decoder.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\Juani\Desktop\StockScan\client ode_modules\src\zxing-html5-qrcode-decoder.ts' ???? Thanks for the video! ill keep trying to make it work
import React, { useEffect, useState } from 'react';
import { Html5QrcodeScanner } from 'html5-qrcode';
import './App.css';
function App() {
const [scanResult, setScanResult] = useState(null);
const [manualSerialNumber, setManualSerialNumber] = useState('');
useEffect(() => {
const scanner = new Html5QrcodeScanner('reader', {
qrbox: {
width: 250,
height: 250,
},
fps: 5,
});
let isScanning = true;
scanner.render(success, error);
function success(result) {
if (isScanning) {
scanner.clear();
setScanResult(result);
isScanning = false; // Set isScanning to false to stop further scanning
}
}
function error(err) {
console.warn(err);
}
}, []);
function handleManualSerialNumberChange(event) {
setManualSerialNumber(event.target.value);
}
return (
QR Scanning Code
{scanResult ? (
Success: {scanResult}
Serial Number: {scanResult.slice(-16)}
) : (
Or enter the serial number manually:
{manualSerialNumber && (
Serial Number: {manualSerialNumber.slice(-16)}
)}
)}
);
}
export default App;
Hi...this code doesn't scan using a live camera but only when i upload the picture.....what might be the problem?
import React, { useEffect, useState } from 'react';
import { Html5QrcodeScanner } from 'html5-qrcode';
function App() {
const [scanResult, setScanResult] = useState(null);
const [manualSerialNumber, setManualSerialNumber] = useState('');
useEffect(() => {
let scanner;
async function initializeScanner() {
try {
scanner = new Html5QrcodeScanner('reader', {
qrbox: {
width: 250,
height: 250,
},
fps: 5,
});
scanner.render(success, error);
} catch (error) {
console.error('Error initializing scanner:', error);
}
}
function success(result) {
setScanResult(result);
}
function error(err) {
console.warn(err);
}
initializeScanner();
return () => {
if (scanner) {
scanner.clear();
}
};
}, []);
function handleManualSerialNumberChange(event) {
setManualSerialNumber(event.target.value);
}
return (
QR Scanning Code
{scanResult ? (
Success: {scanResult}
Serial Number: {scanResult.slice(-16)}
) : (
Or enter the serial number manually:
{manualSerialNumber && (
Serial Number: {manualSerialNumber.slice(-16)}
)}
)}
);
}
export default App;
u can use this code .
Good tutorial.I am loading this in webview for android app.But the cam is not opened for QR code.It triggers error.Also the qr code image path is not loaded.
Any idea?
very good tutorial helped me alot, thankyou
thankyou so much it is very helpful 😇
does it work for you?
@@kovereduard637 yes, i used it in production and currently its working good 👍
@@shekherkaushik.18 did you adjust the code or the one from the video is working? could you please provide me the code that worked for you?
@@shekherkaushik.18 also did the camera part work?
@@kovereduard637 yes actually applied some changes but i cant provide the modified code cause i am using it in my company's project....... sorry for that
Very good video tutorial, I have a question:
is it possible to modify the interface and labels of the qr reader?
It seems there isn't a simple solution for doing that at the moment beyond styling the UI that is injected with CSS.
However, if you are willing to write a bit more code, for now you could wait for the particular element you want to exist (e.g. change a label for) using the MutationObserver and then modify it. It is a bit of a workaround in terms of intercepting elements rather than modifying them within the library but it seems like the best solution for now.
In case you are unfamiliar with it, here s a basic introduction: ruclips.net/video/onzJwmACYAc/видео.html
hello. Thanks for the good solution.
Is it possible to communicate with the server by binding data to QR code?
Is it possible to scan the QR code and display a modal window rather than a results page?
I've been thinking about solving this problem for several days.
Thank you. Very useful !
Hi, is it possible to use an external camera? Like cam scanner, web cam or something else
Use Iriun WebCam. Installed on both the phone and the PC.
Is there any way to upload image as an identification card with a qr-code in it and scan it ? I tried it right now it doesn't recognize the qr-code in it
Technically, this should be possible as long as the QR code is visible next to whatever else is on the ID card (as long as it's not another code).
A possible option for increasing the chances of it scanning successfully is to increase the 'fps' value (frames per second) for detecting a code in the options object. This will mean it attempts to read the code more often but can start affecting perforance is you set it too high (a value up to 1000 is possible according to the docs).
If there is some other code on the card and you want to limit it, you can add this property to the options object to limit detection to QR codes only:
formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ]
it works on mobile devices?
thanks for the code
but i want when i click on the turnon button then only camera start not before
How to fix :Uncaught TypeError: Cannot read properties of null (reading 'videoWidth')
Thanks Man.
Hi, can it scan barcode as well?
thanks
This is a cool tutorial but for some reason I keep gettign this error "Uncaught HTML Element with id=reader not found".
I am also faced same issue, I make sapareated QR code file , its resolved
Can with qrcode and barcode 128?
Why do you sound like you are being kidnapped lol
Cool
share your github repo link
When I reload the page, the camera appears twice and I want to change the style
how u fixed this?@@jhonuribe171
@@jhonuribe171 did you solve it, I am also facing same problem
is this working
for react 18.17.0
npm i html5-qrcode --legacy-peer-deps
@@ochnico7658 and also 18.2.0 right?
HTML Element with id=reader not found
at handleError (localhost:4200/static/js/bundle.js:334531:58)
at localhost:4200/static/js/bundle.js:334550:7
at Object.invokeGuardedCallbackDev (localhost:4200/static/js/bundle.js:293939:20)
at invokeGuardedCallback (localhost:4200/static/js/bundle.js:293996:35)
at reportUncaughtErrorInDEV (localhost:4200/static/js/bundle.js:309929:9)
at captureCommitPhaseError (localhost:4200/static/js/bundle.js:313591:9)
at commitPassiveMountEffects_complete (localhost:4200/static/js/bundle.js:311658:13)
at commitPassiveMountEffects_begin (localhost:4200/static/js/bundle.js:311646:11)
at commitPassiveMountEffects (localhost:4200/static/js/bundle.js:311636:7)
at flushPassiveEffectsImpl (localhost:4200/static/js/bundle.js:313519:7)
i'm getting this error
You need create div element with id = reader
console.log(scanResult) in useEffect no value
Hello! am i the only one who gets 23 warnings like this one:
WARNING in ./node_modules/html5-qrcode/esm/zxing-html5-qrcode-decoder.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\Users\Juani\Desktop\StockScan\client
ode_modules\src\zxing-html5-qrcode-decoder.ts' file: Error: ENOENT: no such file or directory, open 'C:\Users\Juani\Desktop\StockScan\client
ode_modules\src\zxing-html5-qrcode-decoder.ts'
????
Thanks for the video! ill keep trying to make it work
please do install the needy dependency for it ...
hey bro, I got the same problem, please tell me if you found how to solve that
what do you mean ?@@agnesdaisy5186