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.9k stars 958 forks source link

Camera cannot focus the QR code in HuaWei Device #690

Open Tomme-wong opened 1 year ago

Tomme-wong commented 1 year ago

When open the scanner, the camera cannot focus the QR code.

issue

Is there any setting or config i can try?

ROBERT-MCDOWELL commented 1 year ago

focusMode: "continuous"

Tomme-wong commented 1 year ago

focusMode: "continuous"

html5QrCode .start( camera, config,

is this config put into camera camera setting or config object? I tested both, it doesn't work.

Also i tested the html5QrCode.applyVideoConstraints({focusMode: "continuous"}) seems not working too.

ROBERT-MCDOWELL commented 1 year ago

I use it it in the scanner config where you put all settings like qrbox etc... here is my whole config {fps: 8, qrbox: {width: 250, height: 250}, rememberLastUsedCamera: true, disableFlip: true, aspectRatio: 1, facingMode: {exact: "environment"}, focusMode: "continuous", supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA,Html5QrcodeScanType.SCAN_TYPE_FILE] , formatsToSupport: [Html5QrcodeSupportedFormats.QR_CODE], showTorchButtonIfSupported: true, useBarCodeDetectorIfSupported: true, showZoomSliderIfSupported: true, defaultZoomValueIfSupported: 2}

Topiya commented 1 year ago

I use it it in the scanner config where you put all settings like qrbox etc... here is my whole config {fps: 8, qrbox: {width: 250, height: 250}, rememberLastUsedCamera: true, disableFlip: true, aspectRatio: 1, facingMode: {exact: "environment"}, focusMode: "continuous", supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA,Html5QrcodeScanType.SCAN_TYPE_FILE] , formatsToSupport: [Html5QrcodeSupportedFormats.QR_CODE], showTorchButtonIfSupported: true, useBarCodeDetectorIfSupported: true, showZoomSliderIfSupported: true, defaultZoomValueIfSupported: 2}

@ROBERT-MCDOWELL showZoomSliderIfSupported and defaultZoomValueIfSupported options are not working when we use html5QrCode.start(). It is working only with html5QrcodeScanner.render()

Does above options working for you with html5QrCode.start() ?

ROBERT-MCDOWELL commented 1 year ago

I use only html5QrcodeScanner, which is built on top of the html5Qrcode class so you should find the equivalent in the docs

OrchardRX commented 4 months ago

Hello, have you resolved Huawei's inability to focus? I have also encountered this problem. May I ask how you can solve it

cm080691 commented 1 month ago

I am using iphone 14pro camera to scan the UPC-A barcode for products scan.

However, I am getting blurry image while it is closer to the camera (kind of macro mode). Is it a persistent issue of camera being not focused in closed distance?

Is there any resolution coming on this?

Image (1)

T-mac-one commented 1 month ago

Hey guys, you can try modifying the resolution to make it clear. html5Qrcode.start( { facingMode: "environment", }, { aspectRatio: 1.777778, // 16:9 focusMode: "continuous", fps: 15, videoConstraints: { facingMode: 'environment', width: 9999, // It may be useful!! }, qrbox: { width: 280, height: 280, }, },