Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova: Scanner appears in full screen #947

Open
davidjandrey-sv opened this issue Aug 30, 2024 · 0 comments
Open

Cordova: Scanner appears in full screen #947

davidjandrey-sv opened this issue Aug 30, 2024 · 0 comments

Comments

@davidjandrey-sv
Copy link

davidjandrey-sv commented Aug 30, 2024

Description
When using this feature in a Cordova native app on iOS, the scanner isn't (just) embedded in the DOM as on web, but with it appears a fullscreen overlay with an X in the top left and a mute button in the top right, that doesn't seem to contain scanner functionality. Once that view is closed via the X button, the DOM-embedded scanner is frozen.

We don't want that to happen, we just want it to be integrated into our webpage, just like it works for us in Chrome, Firefox and Safari.
I'm not sure whether this is a bug or a configuration issue, so here's the relevant code snipped from our side:

const configSetup: Html5QrcodeFullConfig = {
    verbose: false,
    formatsToSupport: [
        Html5QrcodeSupportedFormats.QR_CODE,
        Html5QrcodeSupportedFormats.EAN_8,
        Html5QrcodeSupportedFormats.EAN_13,
    ],
}

const configUI: Html5QrcodeCameraScanConfig = {
    fps: 10,
    videoConstraints: {
        height: { min: 720, ideal: 1920, max: 2560 },
        width: { min: 480, ideal: 1080, max: 1440 }, // no idea why this has to be the wrong way around
        facingMode: "environment",
    },
    qrbox: (w, h) => {
        const size = Math.min(w, h) * 0.9
        return {
            width: Math.max(size, 50),
            height: Math.max(size, 50),
        }
    },
}

const scanner = new Html5Qrcode(elementId, configSetup)
await scanner.start(
    { facingMode: "environment" },
    configUI,
    (text, result) => {
        onResult(text, result.result.format?.formatName)
    },
    () => {}
)

(Also for some reason width and height are swapped for the scanner view in DOM)

iOS native (actual behavior):
image

iOS Safari (expected behavior):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant