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

BrowserCodeReader.listVideoInputDevices() doesn't ask for Camera permission on MacOS and iOS #97

Open
andrijavulicevic opened this issue Aug 3, 2022 · 2 comments

Comments

@andrijavulicevic
Copy link

Hello, I am using this library to implement a QR Code Scanner on a web page. And I have encountered strange behavior on MacOS and iOS browsers.

Method BrowserCodeReader.listVideoInputDevices() does not ask for permission to access Camera on mentioned OSes and code simply doesn't work at all, unless a user goes to Google Chrome settings and manually enables camera permission, and only after that this method works properly.

Here is a demo to test the bug: https://replit.com/@AndrijaVulicevi/QR-code-scanner#src/App.jsx

Reproducible on:

  • MacOS 12.5 with Google Chrome 103.x and Safari 15.6
  • iOS 15.6 with Safari iOS 15.6**
@obo-spi
Copy link

obo-spi commented Oct 5, 2022

I made this before listing

      const camera = await navigator?.mediaDevices
        ?.getUserMedia({ video: true })
        .catch(() => showWarning(t('captureModal.cameraUnavailable')))

      if (camera) {
          const videoInputDevices = await BrowserCodeReader.listVideoInputDevices()
...

@systemutvecklare
Copy link

I made this before listing

      const camera = await navigator?.mediaDevices
        ?.getUserMedia({ video: true })
        .catch(() => showWarning(t('captureModal.cameraUnavailable')))

      if (camera) {
          const videoInputDevices = await BrowserCodeReader.listVideoInputDevices()
...

This one worked for me when we had problems in both Edge and Chrome (116.0.5845.141). This should be handled by listVideoInputDevices

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

3 participants