Skip to content

Trying to use back camera on Android device (Flutter Web app). fetchDeviceList never completes #23

@MomijiMatt

Description

@MomijiMatt

I'm using an Android tablet running this as a Flutter web app. I'm using Quagga like the example. The barcode.js code looks like this:

function detectBarcode(dataUrl, callback) {
    Quagga.decodeSingle({
        decoder: {
            readers: [
                "code_128_reader",
                "ean_reader",
                "ean_8_reader",
                "code_39_reader",
                "code_39_vin_reader",
                "code_93_reader"
            ] // List of active readers
        },
        locate: true, // try to locate the barcode in the image
        src: dataUrl // or 'data:image/jpg;base64,' + data
    }, function (result) {
        if (result && result.codeResult) {
            console.log("result", result.codeResult.code);
            callback(result.codeResult.code);
        } else {
            console.log("not detected");
        }
    });
}

After some research I thought maybe I could use the CamCodeScannerController.selectDevice() function to set it to the back camera. So I tried to use CamCodeScannerController.fetchDeviceList(), but that never completes when I call it (i.e. if I do await CamCodeScannerController.fetchDeviceList() it never gets past that line).

At this point I'm not even sure if I'm supposed to be setting the device in the Quagga code or in the CamCodeScannerController.

So to reiterate: The end goal is to get it to use the back camera instead of the front camera.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions