At the end of this tutorial you will have
- A native extension for AIR that connects with the native camera and captures frames from it.
- A test app that uses the native extension and can help you test and debug its code.
I’ve broken down the tutorial into parts, each of which should take between 5 and 20 minutes to implement.
I expect the full tutorial to take you between an hour and a half and two hours in total. You’ve got to love software project estimates. If you’ve completed the whole tutorial, leave a comment and let me know whether my estimate was way off base.
How is this tutorial structured?
Parts 1-3 set up the infrastructure for your ANE and test app:
- Part 1: Create a test app – 15-20 minutes
- Part 2: Set up the Xcode project – 8-10 minutes
- Part 3: Set up the AIR Library – 8-10 minutes
In parts 4-8 you get your hands dirty with native code and learn about AVFoundation, some Objective-C and passing pixel data between Objective-C and ActionScript:
- Part 4: Connect to the camera in Objective-C – 15-20 minutes
- Part 5: Start the camera from ActionScript – 5-6 minutes
- Part 6: Grab frames from iOS camera – 15-20 minutes
- Part 6A: Fake triple buffering – 5-7 minutes, optional
- Part 7: Pass video frames to ActionScript – 15-20 minutes
- Part 8: Stop the camera – 6-7 minutes
Part 9 is the moment of truth, where you see the results of your labor:
- Part 9: Test it [coming soon]
And in part 10 we discuss how you can use the code you have produced as a base for other ANEs and projects:
- Pat 10: The possibilities are endless… [coming soon]
The Flex SDK offers a way of quickly putting together the UI of your app. In this tutorial I want us to focus on the tricky bits: native code for controlling the camera, rather than building UI from Sprites. You can replicate the idea in Flash, if your app must be ActionScript-only.
Check out the DiaDraw Camera Driver ANE.
This tutorial looks great. I will start following it tomorrow.