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

Multiple Cameras #3

Open
mcallistertyler opened this issue Oct 7, 2019 · 2 comments
Open

Multiple Cameras #3

mcallistertyler opened this issue Oct 7, 2019 · 2 comments

Comments

@mcallistertyler
Copy link

Something I've noticed when using this package is that Android phones with multiple cameras don't default to their "best" environment camera. Newer Huawei and Samsung phones seem to be the main culprits for this, their default environment cameras are either very blurry or zoomed in meaning they can't scan QR codes that are small.

Is there anyway that a user could be able to select from one of the many cameras on their phone? I think this functionality would be great to have.

@tahv0
Copy link
Owner

tahv0 commented Oct 17, 2019

@mcallistertyler95 Sorry for late response.

One could iterate camera devices with this
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices

and then you can set your camera via constraints-prop.

https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints

@mcallistertyler
Copy link
Author

mcallistertyler commented Oct 21, 2019

Thanks for the reply!

With what I'm currently trying to implement I'd like to be able to select from multiple cameras available (perhaps via dropdown or something similar). But it seems that whenever I give a camera id to the constraints-props the camera doesn't re-render with the selected camera.

Right now I'm using my own fork of this repository where I can directly pass the camera ID as a prop to bypass the checks made by the defaultDeviceIdChooser function. But I'm not very well versed in JS or Web APIs in general so the implementation is fairly hacky.

Is there any way to trigger a re-render of the component when updating constraints?

Thanks again

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

2 participants