ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

Default camera as Front camera for mobile/Tab users

Open ajithK24 opened this issue 4 years ago • 2 comments

Instead of opening the back camera as default, especially in mobile/tab I would like to make default camera should be front camera. Is there any option for that?

ajithK24 avatar Oct 21 '21 10:10 ajithK24

I'd suggest implementing another @Input() Setter for the matching function, something like autostartCameraMatcher. In the method autostartScanner we could then use this matching fn if provided, otherwise just use the existing one. That way the user could provide a custom matcher function and therefore can choose his preferred device. image

I could implement this as a hacktoberfest contribution if you are ok with that.

ChLah avatar Oct 23 '21 09:10 ChLah

It would be great to have possibility to implement own algorithm for find correct camera. Like someone wrote on one of issue -> matcher presented in listing above is not multi language friendly. And also for Firefox because its return something like "Camera Input 1", "Camera Input 2" as a label in MediaDeviceInput.

So...for my case best solution for find correct camera is: navigator.mediaDevices.getUserMedia({ video: { facingMode: { exact: 'environment' } }, });

I am currently implementing this for the cameraFound event, but this is overridden by autostartScanner([... devices]); in the initAutostartOn method.

DawidKuzminski avatar Nov 10 '21 15:11 DawidKuzminski