mebjas / html5-qrcode

A cross platform HTML5 QR code reader. See end to end implementation at: https://scanapp.org
https://qrcode.minhazav.dev
Apache License 2.0
4.92k stars 961 forks source link

Compatibility - [IOS] [Chrome , Safari] - Iphones aren't reading barcode #915

Open diegobustosk opened 5 months ago

diegobustosk commented 5 months ago

Describe the bug A clear and concise description of what the bug is.

Describe the browser:

Screenshots image image

import { Html5QrcodeScanner, Html5QrcodeScanType } from 'html5-qrcode'; import { useEffect, useRef } from 'react'; const Html5QrcodePlugin = (props) => { const scannerRef = useRef(null); // useRef para mantener la referencia del escáner const qrcodeRegionId = "html5qr-code-full-region"; // ID del contenedor del escáner useEffect(() => { // Solo se ejecuta una vez, ya que el array de dependencias está vacío if (!scannerRef.current) { scannerRef.current = new Html5QrcodeScanner( qrcodeRegionId, { fps: props.fps, qrbox: props.qrbox, aspectRatio: props.aspectRatio, disableFlip: props.disableFlip, focusMode: "continuous", rememberLastUsedCamera: true, supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA], experimentalFeatures: { useBarCodeDetectorIfSupported: true }, willReadFrequently: true, advanced: [{ zoom: 2.0 }] }, props.verbose ); } const startScanner = () => { scannerRef.current.render( props.qrCodeSuccessCallback, props.qrCodeErrorCallback ); }; setTimeout(() => { startScanner(); }, 0); return () => { scannerRef.current.clear().catch((error) => { console.error("Failed to clear html5QrcodeScanner.", error); }); }; }, []); return <div id={qrcodeRegionId} />; }; export default Html5QrcodePlugin;

{showScanner && ( <Html5QrcodePlugin fps={10} qrbox={250} disableFlip={false} qrCodeSuccessCallback={onNewScanResult} /> )}

mwcz195 commented 4 months ago

We're facing the same problem. Code recognition success rate on iPhone 13 and 15 models is very low (less than 10%), while on android devices, the recognition is very fast. iPhone 13 Pro has 3 lens. And when you do a close-up scan, iPhone will automatically switch lens to make the capture clear. However, the recognition is still not happening. iPhone 15 has two lens. When you do a very close-up scan, the image is blurred. There is no close-up lens available to make the capture clear (even with native iOS camera app). You have to keep the camera at a medium distance to make the image clear The initial test suggests it may be more related to iOS camera & scanning library integration issues, and less a lens-switch issue

d3thomas commented 3 months ago

Has anyone found any solutions for this?

chinjon commented 3 months ago

i too am stumped at how this API is performing poorly with iphones. The only thing i can think of is that the non-pro models do not have macro capabilities