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

facingMode not working (iPhone X, XR, XS) #6

Closed
ymfHU opened this issue Jul 18, 2019 · 9 comments
Closed

facingMode not working (iPhone X, XR, XS) #6

ymfHU opened this issue Jul 18, 2019 · 9 comments

Comments

@ymfHU
Copy link

ymfHU commented Jul 18, 2019

I set the facingMode to rear but sill using the front camera. (Tested on iPhone X, XR, XS)

@kybarg
Copy link
Owner

kybarg commented Sep 7, 2019

@ymfHU This project is targeting desktops in the first place. You can have a look at JodusNodus/react-qr-reader. I'll try to add wider support some time soon

@ankurbabu
Copy link

@ymfHU Did you able to solve the issue? I am also facing the same issue, it works in android but not in iphone :(

@zzynx
Copy link

zzynx commented Jan 31, 2020

Experiencing the same problem with an iPhone 8.

This project is targeting desktops in the first place.

That's a pitty.

You can have a look at JodusNodus/react-qr-reader.

I'm coming from that lib.
I have to read QR-codes from the screen of measuring devices (so not from paper).
And react-qr-reader doesn't seem to be able to read them.
I hoped react-qr-scanner would.

@lucasapereira
Copy link

I am having the same problem here with iPhone

@kybarg
Copy link
Owner

kybarg commented Jun 24, 2020

this project is aimed toward desktop browsers usage,
for mobile devices please use https://github.com/JodusNodus/react-qr-reader

@devcshort
Copy link

devcshort commented Jul 29, 2020

this project is aimed toward desktop browsers usage,
for mobile devices please use https://github.com/JodusNodus/react-qr-reader

Most of us were coming from that lib already in hopes that this one would fix the underlying issues with that library (like not being able to scan codes from a screen).

@amaan-ahmad
Copy link

amaan-ahmad commented Aug 12, 2020

facingMode doesn't work as set at first load, but when we reload the page then it loads the facingMode set by the programmer.
.Talking about any mobile device over chrome browser for mobile.

@kybarg
Copy link
Owner

kybarg commented Nov 3, 2020

Closing this issue as for #8 component will accept constraints directly

@kybarg kybarg closed this as completed Nov 3, 2020
@misaizdaleka
Copy link

misaizdaleka commented Jan 29, 2021

I was also getting this error (on iPhone), but I found a solution.

The main thing here is to call two mediaDevices functions for querying available cameras and only then show/render the component.

Here's a code snippet doing exactly that:

const detectCamera = async () => {
    await navigator.mediaDevices.getUserMedia({ audio: false, video: true });
    await navigator.mediaDevices.enumerateDevices();

    setPermissionGranted(true);
  };

  useEffect(() => {
    (async function effectDetectCamera() {
      await detectCamera();
    })();
  }, []);

  return permissionGranted  ? 
    <Reader onError={handleError} onScan={handleScan} facingMode="rear" />
   : 
    <div>permission denied</div>
  ;

Here's a full working example

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

8 participants