Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Firefox Error: Camera permissions are not available in this browser #259

Open
pavva91 opened this issue Jun 7, 2023 · 3 comments
Open

Comments

@pavva91
Copy link

pavva91 commented Jun 7, 2023

Is your feature request related to a problem? Please describe.
I managed to run the barcode-scanner on chromium-based browsers, is it planned to run the barcode-scanner also on firefox?
Describe the solution you'd like
A clear and concise description of what you want to happen.
Run the scanner on Firefox
Describe alternatives you've considered
I tried alternative solutions (my stack is vue/ionic/capacitor) with no luck:

Additional context
I took the code from: https://github.com/capacitor-community/barcode-scanner#usage

@thegnuu
Copy link
Collaborator

thegnuu commented Jun 8, 2023

The current browser solution is in beta and not ready for production, so it is possible that this implementation has issues. We are working on a better solution for the future, but this has currently not the highest priority since we are working on other issues at the moment. I will keep the issue open and inform you about some news.

@pavva91
Copy link
Author

pavva91 commented Jun 8, 2023

I looked into it and it looks like that the error is generated by this call:

const permission = await window.navigator.permissions.query({

and is related to this: mozilla/standards-positions#19 (comment)
Basically Firefox is not implementing query for "camera".
After a quick research I found out that on firefox must use this to prompt for camera permission: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
on code should be something like that:

      const firefoxPermission = navigator.mediaDevices.getUserMedia({ video: true });

Is it possible to try a PR to fix this?

pkunszt added a commit to pkunszt/barcode-scanner that referenced this issue Aug 28, 2023
@pkunszt
Copy link
Contributor

pkunszt commented Aug 28, 2023

Just opened a PR for this. With this, firefox is also working. @pavva91

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

No branches or pull requests

3 participants