instascan
instascan copied to clipboard
Demo: why two confirmations for camera access?
I was wondering why I am asked twice to allow the camera in the demo (whereas I have only one by the way)
Is it expected? Thanks :)
Same problem here, not only in demo. Talking about mobile browsers, I've encountered this problem in Opera and Firefox, but not in Chrome.
@leplatrem might be approval per camera - front and rear.
I only have one though.
It could be one auth for listing the cameras, and another one when choosing one?
I am experiencing this too, on demo and personal implementation. Across different browsers, tested in Firefox desktop and Chrome mobile.
A user has to click allow twice for camera permissions.
Useful thread: https://stackoverflow.com/questions/15993581/reprompt-for-permissions-with-getusermedia-after-initial-denial
Note the comment "HTTPs on Firefox won't persist this permission."
Chrome on the demo, which has https, only requests permission once. When using Firefox or http you'll have to give permission twice.
I think getCameras() requires a first permission request to just access the user medias list. Then start() requires a second one. This is on Firefox only as @SmileyJames wrote earlier because Chrome automatically persists the permission. The problem with Chrome is that on mobile it won't let you choose facing or environment cam. I have no good solution yet. :(
The navigator.mediaDevices.getUserMedia() is called twice:
- once when listing the cameras (through Camera.getCameras())
- once from Camera.start(), and not with the same settings
That may be the reason. Change proposed with PR https://github.com/schmich/instascan/pull/213