gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.03k stars 330 forks source link

Samsung Galaxy A52s/A25 - camera defaults to wide angle #437

Open Asko-Dev opened 1 week ago

Asko-Dev commented 1 week ago

Describe the bug We tested and didn't have any issues with iPhone 15 Pro max, iPhone 14 Pro max (which also have wide angles). But on Samsung Galaxy A52s and Samsung Galaxy A25, the camera defaults to wide angle and makes reading barcodes hard or even impossible cause of the distorted fish eye. We opened the full Demo with the two Samsung phones to see the camera options and what it defaults to - it does choose the "rear camera" and yet still that somehow defaults to 0.5 zoom.

To Reproduce Have the Samsung Galaxy A52s or Samsung Galaxy A25 or presumably other Samsung phones? And open the full demo

Screenshots "zadni fotoaparat" means rear camera .. so these are the camera options, originally the rear camera was checked I then tried other options, the 2.0 is the 1 zoom

Samsung Galaxy A52s WhatsApp Image 2024-06-18 at 18 45 01

Samsung Galaxy A25 Samsung Galaxy A25

Wide angle photo wide_angle

Smartphone (please complete the following information):

I know I can give the people the option to choose cameras, but for e.g. iphone 15 that is like 7 options that dont say much to an average user and it feels like it would just further confuse them, is there a way to force it to default to 1 zoom? Does anybody else have this issue? I saw both Samsung phones label the 1 zoom with "2.0" but to try to prefer it through forloop feels very wrong.

Is this a known thing or a bug? How would you go about it?

Thank you

Asko-Dev commented 1 week ago

update: Samsung Galaxy A70 seems to open up correctly on 1 zoom, Samsung Galaxy A34 as well ... thought it's a samsung problem but now I am confused even more. Any ideas?

gruhn commented 1 week ago

Yes, unfortunately that's a well known issue. See for example #322. Previously, we tried all kinds of heuristics including a manually maintained black list of "bad cameras". But it turns out the camera names vary based on language so they are not even unique for the same device/OS combination:

https://github.com/gruhn/vue-qrcode-reader/blob/b057338f8c341ac74e6c1ac7f72ca6bf13117f73/src/misc/camera.js#L33

Asko-Dev commented 1 week ago

Yes, unfortunately that's a well known issue. See for example #322. Previously, we tried all kinds of heuristics including a manually maintained black list of "bad cameras". But it turns out the camera names vary based on language so they are not even unique for the same device/OS combination:

https://github.com/gruhn/vue-qrcode-reader/blob/b057338f8c341ac74e6c1ac7f72ca6bf13117f73/src/misc/camera.js#L33

thank you for your answer. So is it pointless to add stuff to the blacklist now? Or is that still a thing we're trying, cause based on the screenshots sent to me from the Samsung phones, the "bad" cameras are consistently named camera2 X where X is a num higher than 0 (viz screenshots), maybe if we confirmed this we could rule out anything that has a different X than 0?

But to be fair I don't know how dangerous this could be considering the string we would look for and potentially ban based upon is pretty short

gruhn commented 1 week ago

The blacklist was removed in v5.0.0 in favor of the constraints prop. So you could re-implement the blacklist approach on your end. But unless you target a manageable known set of client devices, it's probably not gonna work well in general.