cordova

11 thoughts
last posted Feb. 20, 2017, 12:04 a.m.

4 earlier thoughts

0

My preferred (tic tok, tic tok) option 3 hasn't worked out.

So actually went with a fourth option: drop in the Objective C port of ZXing, instead of using the C++ library.

Seemed to be an easier path -- as far as integrating with the rest of the cordova plugin.

But...

All of these scanning plugins, on iOS, seem to rely on the AV Foundation framework to access the camera.

To set up the camera for scanning barcodes, you need to:

  1. Get a AVCaptureDeviceInput reference to get camera input, and

  2. Declare the AVCaptureMetadataOutput details of camera frames you're interested in receiving.

As part of the setup of AVCaptureMetadataOutput, you need to flag what barcode formats the AV Foundation functions should look for before it passes the images back to your code. If the format isn't on the list of supported types, don't expect any images.

Guess which format AV Foundation doesn't list.

So, while zxing supports Codabar, it's not being sent the camera frames since AVCaptureMetadataOutput doesn't recognise it.

There doesn't appear to be a way to tell this framework "just send me the damn frames, and I'll parse the thing myself".

I suppose this is meant to help performance, and not have random apps slowing the phone down trying to chew through a massive queue of images to process, but that doesn't really help me much.

May need to find alternative way of fetching camera frames, but it's never good news, or a good smell, when you need to start fighting the platform.

6 later thoughts