Hi all,
I've been playing with the new APIs for barcode scanning built into iOS7 and it's pretty trivial to make a Gideros plugin for it - but I'm just wondering about the API design. What would be the best way to go about it? Open up the AVCapture (eg. Camera view) and then return a value to Lua when a number of samples of the barcode are the same (eg. the iOS7 SDK returns the value, and if it returns the same value 5 times in a row, then we have confirmation that the barcode or QR code is accurate), or do you think I should do a callback to a Lua function?
I'm happy to make a plugin for the community, but I would like get some input on the best way forward for the plugin's API so that it would be useful.
Best,
- Ian
Comments
On one hand I would assume it should be async and you should use callback (but its harder to implement),
but if you will open and show camera, then the app does not run either way, so you may as well block it and wait till IOS7 returns value (easier way)
If you ask from usability, then probably I would go with async callback
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
As for ZXing, the Cordova project has a barcode scanner using ZXing for Android and iOS … I was kinda thinking about porting it, but I really only need it for iOS7 myself and it's a piece of cake compared to porting the Cordova plugin.
If you're interested in taking a look:
iOS: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/BarcodeScanner
Android: https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner
Thank you @ar2rsawseen for your feedback … I'll mull over it a bit. I can see the advantages of async and running the Gideros engine in the background. For example, the iOS7 example code has a QR code music playing demo app (the codes trigger specific notes as a *very simple idea* etc) - you don't necessarily want to block Gideros from running just because there's a camera view. And the camera view doesn't have to obscure the whole screen either - just a portion of it would be fine.
Anyone else want to take a stab with some ideas of what they'd like?
Cheers,
- Ian
GiderosApp -> scan://mycallback=myapp
this will then start the scan app which will take a scan and using the passed URL call -> myapp://data=scanneddata
yes it needs two apps, but the scan app can be used from any application, I think that is quite neat.
I'll have a look at the plug-ins, not very happy with the PhoneGap plug-ins at times.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps