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

Switch to another camera when click on the video area #3

Merged
merged 2 commits into from
Jul 1, 2023

Conversation

yuiseki
Copy link
Contributor

@yuiseki yuiseki commented Jul 1, 2023

My laptop has several real and virtual cameras.
I couldn't capture the QR code without the proper camera, so I tried switching to a random another camera when I clicked on the video area.
Cameras are switched in the order in which they were acquired.
Please consider this change as I need this change for my trial and error colleemap!

Image from Gyazo

Copy link
Owner

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to click through the cameras in some deterministic order instead of doing it randomly?

@yuiseki
Copy link
Contributor Author

yuiseki commented Jul 1, 2023

@vmx I believe we can also switch camera as specific order. Please wait as I make changes to this Pull request!

@yuiseki yuiseki marked this pull request as draft July 1, 2023 13:28
@yuiseki yuiseki changed the title Switch to a random camera when click on the video area Switch to another camera when click on the video area Jul 1, 2023
@yuiseki yuiseki requested a review from vmx July 1, 2023 13:45
@yuiseki yuiseki marked this pull request as ready for review July 1, 2023 13:45
@yuiseki
Copy link
Contributor Author

yuiseki commented Jul 1, 2023

It works as expected on a PC, but there is a problem with the inward facing camera being selected first instead of the outward facing camera on a smartphone...

Copy link
Owner

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good! Thanks.

@vmx vmx merged commit 105d4f4 into vmx:main Jul 1, 2023
@vmx
Copy link
Owner

vmx commented Jul 1, 2023

It works as expected on a PC, but there is a problem with the inward facing camera being selected first instead of the outward facing camera on a smartphone...

It would be great to fix that. What about setting again qrScanner.setCamera('environment') in the beginning. Perhaps there is a way to get the ID of the current camera, that index would then be the "start index" and you keep the rest the same.

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.

None yet

2 participants