julienboulay / ngx-barcode-scanner

An angular barcode reader
https://julienboulay.github.io/ngx-barcode-scanner
MIT License
52 stars 22 forks source link

iOS 14 issue #43

Closed lucifer63 closed 4 years ago

lucifer63 commented 4 years ago

Hello!

iOS 14 release broke some interfaces related to getUserMedia, so now ngx-barcode-scanner doesn't work as expected on iOS 14:

https://github.com/serratus/quaggaJS/issues/444 https://github.com/ericblade/quagga2/issues/244

Seems the trouble can be fixed just by omitting aspectRatio or setting it to {min: 1, max: 1}. May i please ask you to fix it or give us the ability to pass aspectRatio to your component? Or maybe entire constraints object. Sure i can do it myself, but im not very familiar with github and its community unspoken rules, and im afraid to break architecture of your project. If you have a minute to guide me a bit about how these changes should be done, i'll sure create a merge request with all the needed changes myself asap,

And a lil question unrelated to this issue, just curious: do you consider using quagga2? Seems original quagga is orphan and unmaintained at the moment,

Thanks in advance!

ericblade commented 4 years ago

Hi all! Thanks for the ping! :-) Always glad to discover a project that I didn't know about that uses quagga :) I am presently maintaining @ericblade/quagga2 and would love to help.

I would like to note that we (mostly people talking on my repo who have iOS devices, as I do not) are still presently diagnosing the exact root of the problem, but it does seem that iOS is responding to crazy aspectRatio requests with a crazy aspectRatio (so, is it doing the right thing? seems unlikely, even if it is actually giving us what we ask for).

What I can say for sure, is that in iOS 14, the min: 1, max: 100 line is not working. I think that setting max: 2 or something closer to 2, like 1.7777 or 1.8 or something is likely the correct fix, but I will need input from some people with iOS 14 to be sure.

If anyone can inform me how they arrived at the max: 100 line, too, I'd be grateful, so I can figure out where it came from and eliminate it so people aren't using it anymore. :-) Also, if you'd like to change to q2, which is at least maintained, it should be a drop-in replacement at the moment. i have thoughts about some major interface overhauls for the future, but am not going there yet.

julienboulay commented 4 years ago

Hi @lucifer63,

Thanks you for using ngx-barecode-scanner, and for the good feedback. I just released v0.0.9 that fix aspectRatio: { min: 1, max: 1 } and will allow you to configure quagga as an input of the component : [config]="myCustomConfig" See barcode-scanner-livestream.config.ts to know the model for this config.

@lucifer63 and @ericblade : I just discovered quagga2 some days ago. I will consider using it for the next versions of ngx-barecode-scanner.

@lucifer63 Please let me know if version 0.0.9 solve your issue

ericblade commented 4 years ago

Hi Julien! I think max: 2 is a better idea than max: 1. If iOS is being very literal about aspect ratios, and prioritizing it over all other choices, then 1 min 1 max would always give you a square view.

Cheers, if this fixes, then let me know if anything else comes up :-)

julienboulay commented 4 years ago

@ericblade I just pushed v0.0.10 to fix default aspectRatio to min 1 and max 2. It seems to work well now in safari desktop and iOS Thanks