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

Could I use the close button(X) to stop scanner and close camera rather than smaller it ? #920

Open
suki-neithnet opened this issue May 9, 2024 · 0 comments

Comments

@suki-neithnet
Copy link

suki-neithnet commented May 9, 2024

I'm developing on cordova, the camera always shows full sreen, but the qrbox border and shaded region not show, and I can't resize the camera view too.
Then if I click the close button(X) on the top left, it will smaller the camera view and the qrbox border and shaded region shows up, why?
But the camera video paused and the scanner is still running in background, I don't want.

Please look the screenshots below:

IMG_0059
IMG_0060

Codes here, just follow the basic use:

Html5Qrcode.getCameras().then(devices => {
  if (devices && devices.length) {
    var cameraId = devices[1].id;
    const html5QrCode = new Html5Qrcode(/* element id */ "reader");
    html5QrCode.start(
      cameraId, 
      {
        fps: 10,    // Optional, frame per seconds for qr code scanning
        qrbox: { width: 250, height: 250 }  // Optional, if you want bounded box UI
      },
      (decodedText, decodedResult) => {
        // do something when code is read
      },
      (errorMessage) => {
        // parse error, ignore it.
      })
    .catch((err) => {
      // Start failed, handle it.
    });
  }
}).catch(err => {

});

What I want to do are:

  1. custom the camera view.
  2. show the qr box border no matter camera view is in full screen or custom size
  3. when click the close button, could I execute stop scanner and close it rather than smaller the camera view?

Could someone help me with these? it problems me for several days, thank you!

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

No branches or pull requests

1 participant