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

Methods for device selection #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gwue
Copy link

@gwue gwue commented Jan 8, 2025

Added methods to enumerate the clients devices, to open a specific device and to open the "normal" environment camera

I am writing an application where I want to scan barcodes. On my phone though, openCamera() opens the user-facing camera by default.
When supplying an options string to OpenCamera with facingMode: { exact: "environment" }, my rear camera is openend, but with a fish-eye lens.
A reddit comment https://www.reddit.com/r/javascript/comments/8eg8w5/comment/dxvqycs/ mentions, that the most reliable way to open the regular back facing camera, was to just use the last device as returned by enumerate devices, so I also added a method for that.
You may not want to include openNormalEnvironmentCamera but I think listDevices and openCamera(Device device) at least are useful additions

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

Successfully merging this pull request may close these issues.

1 participant