juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
808 stars 470 forks source link

Scanner is using wide camera on Web #878

Open AliEasy opened 9 months ago

AliEasy commented 9 months ago

Hi When opening camera on web, scanner uses wide camera instead of main camera. Is there any way to force it to use main camera?

My device: Samsung galaxy A51

navaronbracke commented 9 months ago

We might need to look into allowing a specific camera for the scanner.

I'm not sure if the web allows us to do that easily.

HossamMohsen7 commented 4 months ago

Any updates or available fixes?

navaronbracke commented 4 months ago

On the web, we do not have a lot of options currently.

If you could test using a barebones web app to see if you can properly identify the "normal" camera using MediaTrackConstraints, then I could try to integrate that into mobile_scanner. Otherwise I cannot do much in this area.

The main problem is that on the web, it is very hard to distinguish the normal camera from the wide-angle camera. After some digging I found that if you provide environment as the facing mode, if there are multiple cameras, the one without the torch could be the normal camera. But I am not sure if that assumption is correct.