ericblade / quagga2-react-example

Showcasing Quagga2 in combination with ReactJS
MIT License
62 stars 40 forks source link

quagga no longer uses reader as an option #9

Closed jerryliuoft closed 4 years ago

jerryliuoft commented 4 years ago

https://github.com/ericblade/quagga2-react-example/blob/master/src/components/Scanner.js#L100

this results that quagga will never find a result.

I've replaced it with the example from instruction { readers: [ 'ean_reader' ], debug: { drawBoundingBox: false, showFrequency: false, drawScanline: false, showPattern: false } multiple: false } seemed to work, but now gota tweak the results to make sure they display properly.

thanks for this example, learned quiet alot from it!

ericblade commented 4 years ago

Hi! I'm not sure if I'm not understanding because of lack of coffee or not, but I'm not quite following what you're saying. If you don't pass a "decoders" array into the Scanner component, it should default to ['ean_reader'] . Is that not the case?

Otherwise, you should be able to do <Scanner decoders={['upc_reader','upc_e_reader']}>, something like that.

jerryliuoft commented 4 years ago

The line I linked currently don't work. It looks like the method definition changed. Readers is no longer an input for Quagga.init() replace readers: decoders to decoder: { readers: ['upc_reader']} to make it work. Hopefully that helped!

ericblade commented 4 years ago

OH, I get it now. Hoo, yeah, OK, I see that should be decoder: { readers } not just readers .. got it.

I wasn't quite as familiar with the interface when I wrote this as I am now.. and I've had enough coffee to make sense out of it now :-)

Thanks for finding that error. I'll correct that right away. I really need to get a camera on a PC that can actually decode, so I can test properly... i'm hoping that with the new quagga2 test system i can actually simulate a camera in the test system and test LiveStream without having to actually scan a barcode with a live camera. :-)

ericblade commented 4 years ago

now it should work like i described above :-D Thanks!