[Feature Request] facingMode constraint is essential for this library to work
See original GitHub issueVery nice and clean module but… is useless without facingMode constraint, device label can be in any language making the camera choice impossible
Example:
{id: "AFB981283186FBA62F2947AA63940A4482BF80C3", label: "Πίσω κάμερα"}
Alternative, selecting between 4 options (devices), where only one option is essential its not the best user experience
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:19 (13 by maintainers)
Top Results From Across the Web
MediaTrackConstraints.facingMode - Web APIs | MDN
The MediaTrackConstraints dictionary's facingMode property is a ConstrainDOMString describing the requested or mandatory constraints placed ...
Read more >Media Capture and Streams - W3C
This document defines a set of JavaScript APIs that allow local media, including audio and video, to be requested from a platform.
Read more >html5-qrcode - npm Package Health Analysis - Snyk
Use this lightweight library to easily / quickly integrate QR code, bar code, ... type of code would be helpful to have, please...
Read more >javascript - GetUserMedia - facingmode - Stack Overflow
facingMode is not yet implemented in Chrome for Android, but works natively in Firefox for Android. You must use standard constraints however: ( ......
Read more >How To Access Front and Rear Cameras with JavaScript's ...
The getUserMedia API makes use of the media input devices to produce a ... To enable this functionality, update the constraints object to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can possibly exposure arguments to
getCameras
so you can request camera of choice and build your user interface on top of it.You can call it like
or
Similar to video part of web api syntax - https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
@dennmtr WDYT?
@mebjas
I’ve done some more tests and found that the problem appears only if the div used by html5qrcode is managed by Vue.js. I’ve swapped the call to
Html5Qrcode#getCameras()
with a call to a generic awaitable (an async/await wrapper ofsetTimeout
) and it worked, so it’s not whatHtml5Qrcode#getCameras()
does, any “time waster” works.There’s probably nothing wrong with html5-qrcode, I must be doing something wrong with Vue (I’m integrating html5-qrcode in a big pre-existing vue app).
EDIT: I was calling
Html5Qrcode#getCameras()
before the component was fully mounted, moved it to the mounted event, now it works as expected. Sorry for having wasted some of your time.