question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No results from the scanner on > iOS 14

See original GitHub issue

The scanning functionality of Quagga stopped working. I tried different aspectRatios and different configurations regarding the camera selection without any success.

The camera selection, on the other hand, and general implementation work fine – the stream starts without any issues. No barcodes (ean_code) are recognized though.

Android works without any issues.

 const QuaggaInit = () => {
        Quagga.init(
            {
                inputStream: {
                    type: "LiveStream",
                    constraints: {
                        width: {
                            min: 450
                        },
                        height: {
                            min: 300
                        },
                        deviceId: selectedDevice ? selectedDevice : "default",
                        facingMode: "environment",
                        /*aspectRatio: {
                            "min": 1,
                            "max": 2
                        }*/
                    }
                },
                locator: {
                    "patchSize": "medium",
                    "halfSample": true
                },
                numOfWorkers: 2,
                frequency: 10,
                decoder: {
                    readers: [
                        "ean_reader",
                    ]
                },
                locate: true
            }, err => {
                if (err) {
                    console.log(err, "error msg");
                }
                Quagga.start();
                return () => {
                    Quagga.stop()
                }
            });
    }

    React.useEffect(() => {
        getDevices();
        checkPermissions();
        Quagga.onProcessed(result => {
            var drawingCtx = Quagga.canvas.ctx.overlay,
                drawingCanvas = Quagga.canvas.dom.overlay;

            if (result) {
                if (result.boxes) {
                    drawingCtx.clearRect(
                        0,
                        0,
                        Number(drawingCanvas.getAttribute("width")),
                        Number(drawingCanvas.getAttribute("height"))
                    );
                    result.boxes
                        .filter(function (box) {
                            return box !== result.box;
                        })
                        .forEach(function (box) {
                            Quagga.ImageDebug.drawPath(box, { x: 0, y: 1 }, drawingCtx, {
                                color: "green",
                                lineWidth: 2
                            });
                        });
                }

                if (result.box) {
                    Quagga.ImageDebug.drawPath(result.box, { x: 0, y: 1 }, drawingCtx, {
                        color: "#00F",
                        lineWidth: 2
                    });
                }

                if (result.codeResult && result.codeResult.code) {
                    Quagga.ImageDebug.drawPath(
                        result.line,
                        { x: "x", y: "y" },
                        drawingCtx,
                        { color: "red", lineWidth: 3 }
                    );
                }
            }
        });

        Quagga.onDetected(detected);

    }, []);

    const detected = result => {
        onDetected(result.codeResult.code);
    };

Test device: iPhone 12 Pro

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
malte94commented, Aug 16, 2022

Interesting observation, I have not debugged it that in-depth.

1reaction
ericbladecommented, Jul 15, 2022

just realized it’s aspectRatio: { ideal: 1 } …

might take a look through this thread for some ideas https://github.com/ericblade/quagga2/issues/419

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to scan QR Code via Camera - Apple Developer
After the update from iOS 13 to iOS 14, the functionality to scan bar code via the Camera app stopped working. A border...
Read more >
How to Find iOS 14's Hidden Code Scanner App - Lifehacker
The “Code Scanner” app is already integrated into the iOS Camera ... Look up “Code Scanner,”; Select the app from the search results...
Read more >
How to Fix Photos People Album Not Populating on iPhone
If your people photos folder won't finish scanning faces, learn what to do in this video. Free download for ReiBoot: ...
Read more >
9 reasons Why Your QR Code is Not Working - Beaconstac blog
If your mobile device (Android or iPhone) still cannot scan the QR Code, try downloading a third-party QR Code scanning app. 4. Why...
Read more >
Your iPhone has a hidden document scanner. This is how to ...
Not to mention a task from a decade ago. But you may have a scanner right in your hand: your iPhone or iPad....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found