ericblade / quagga2

An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
MIT License
758 stars 85 forks source link

Other Media Source / Camera #241

Closed Juphex closed 3 years ago

Juphex commented 4 years ago

Hey, is it possible to use another Media/Picture source ?

I use capacitor for camera access.

github-actions[bot] commented 4 years ago

Thank you for filing an issue! Please be patient. :-)

ericblade commented 4 years ago

Sure. I have no idea what Capacitor is, or what it outputs, but if you can get to an image, then you should be able to either point at it with a file or data URI, and use Quagga.decodeSingle() to point at that.

You might have a look at https://github.com/ericblade/quagga2/blob/master/example/file_input.js .. although that code is before me, so I'm not real sure i'd be able to answer too much about it. It looks like it creates a file input box in browser, uses the given file to create an image element in HTML, then uses canvas.toDataURL to convert that to a Data URI and passes it to Quagga.

ericblade commented 3 years ago

@Juphex anything further that i can help with here?

Juphex commented 3 years ago

@ericblade , no thanks:)