Planète Liège, ANEs, QRCode, Camera and Videos

I’m happy to introduce you a new app: Planète Liège (cork planet) for iOS & Android. The application (in french only) gives lots of information about winemaking. Sometimes making institutional apps reveals many challenges as we will see below.

Camera
In the corkstagram part (I’m sure you get the joke), we take a cork in photo and can customize it with several objects. We needed something integrated into the application, so we couldn’t use the CameraUI class. We used the Camera class, create the object and use the Video object to display it. Our app is forced into portrait mode whereas the Camera object expect a landscape mode on mobile. So we’d to rotate ourselves the Video object. For iOS it works great but for Android on some devices it’s flipped at 180. Unfortunately we can’t have this information, so we’d to put a button on Android for flipping the camera. That’s really a feature that AIR should handle directly.

Change orientation
As I said the application is in portrait mode, but the main part use landscape mode. With AIR you can easily rotate the main content using this snippet:

stage.setOrientation(StageOrientation.ROTATED_RIGHT);

Be careful, on Android (if you’re using Stage3D & Starling) you will lost the context and so it will take time to see the full content of the new part!

StageVideo
Needing StageVideo with Starling? Just set visible false to stage3d! Be careful, it won’t remove touch interactivity etc.

QRCode
We’re in 2014 and it’s complicated to scan a QR Code with AS3. Firstly, I looked for ANEs and the only one I found had several issues: really hard to recompile it due to its IntelliJ integration, managing all the camera stuff which is great but unfortunately we can’t put something on top of Objective-C / Java code, bugs with Android…
Ok so no ANE. But finally I just need to check a bitmap data and there are plenty of AS3 libs making it. So time for a small benchmark? After several test, I was so frustrated… what are those shitty performances? 7 seconds for a QR Code scan, seriously?
Crazy that it’s complicated to scan a QR Code with AS3 nowadays. So I made my first (public) ANE using ZXing library. I included the AS3 lib for the default platform, so it means this ANE works for iOS & Android (using native code) and on all other targets supported by Flash using the AS3 code. Once I made it, I discovered an other one which did the same thing using ZBar lib. However since it isn’t packaged with a default platform, I forked it.

Instagram
We needed to be able to share the corckstagram picture on Instagram. I discovered those ANEs but I wasn’t happy with their structure. I really needed the same API between iOS & Android, and everything into the same ANE. So I forked it and changed its structure.

AIR is a very powerful tool, and ANEs make it so strong.iOS & Android.