It was about time we updated the Camera AIR Native Extension for iOS 7 and AIR SDK 4.0.
We also fixed a couple of bugs along the way, including this one, reported by admin@cuijiahao.com:
What steps will reproduce the problem? 1. Set camExt.startVideoCamera( NativeCameraExtension.PresetPhoto, 24, 50, false); 2. bytearray returned with dimension 852 * 640, which is good 3. after converting the obtained bytearray to bitmapdata, the bitmap image is distorted and unusable * All other presets work very well in the code when I replace PresetPhoto with any other preset.
This has now been fixed.
Download the ANE
The quickest way to get the updated ANE is to download it here.
Where is the manual?
For instructions on how to use the iOS camera ANE, check out the project’s WiKi page.
Need the code?
April 2014 update: We have turned this project into a step-by-step tutorial with complete source code. Check it out on our new website, EasyNativeExtensions.com.
What’s next?
Expect step-by-step tutorials for how to make your own Camera ANE or how to extend the we’ve released. Soon to be published on http://easynativeextensions.com
We will also be taking questions and feature requests. If you can’t wait, post yours in the comments below.
Want more functionality and Android support?
Check out our DiaDraw Native Camera Driver.
Hello, can i get the native path of a video that i record using your native extension?
Thanks.
Hi Italo,
Do you record the file using native code?
If that’s the case, the video file path and name are set by you when you initialize AVAssetWriter:
– (id)initWithURL:(NSURL *)outputURL fileType:(NSString *)outputFileType error:(NSError **)outError;
When using setRotationAngle() the application crashes after about 30 seconds.
XCode shows a ‘vm-pageshortage’ possible memory leak. In the logs you see : Application received a memory warning from the system. The app is then jettisoned and stopped.
When not using the setRotationAngle everything is fine.
Using Instruments with Xcode it is clear there is a memory leak in the part of the code that manages applying rotations to the current frame. Perhaps there is a image reference or tmp variable that is never being released. I’m not an Objc expert but that is what it appears to be. Can you guys take a look and perhaps patch this?
Hi deceapyre,
Well done for smoking this one out!
Is the rotation an important/urgent functionality of your project?
We are currently focused on EasyNativeExtensions.com, where we are about to release a few new extensions and repackage and re-release the old ones (including the camera). The revamped camera ANE might not make it in there for another few weeks, however.
Cheers,
Radoslava
Unfortunately I was banking on this ANE for a video journal app. I’ve exhausted all other options aside from rotating manually in AS3 which is not ideal. Essentially I have an app that is fixed to portrait mode. The camera feed comes in landscape left, so rotating is needed to show the video upright. I will also be saving and encoding the bytearray directly from this ANE, so ideally it should be in the proper orientation. If you guys have other priorities I totally understand i’ll see if there are any other ANEs for this. Thanks for the quick response!
Hi deceapyre,
You can check out the latest from the google repository, now with a fix for the memory leak and with a bunch of other improvements. Here’s the full list:
1. Fixed a memory leak in applyFilters()
2. Improved thread synchronisation
3. Introduced a separate frame rate for consuming frames (see REFRESH_RATE_FRAMES_PER_SECOND in CameraTestAppHomeView.mxml)
4. Introduced NativeCameraExtensionEvent.CAMERA_STARTED to signal when the camera is ready to produce frames
5. Note: getFrameBuffer()’s signature has changed:
public function getFrameBuffer(
_bufferData : ByteArray,
_lastFrameIndex : Number,
_previewFrameSize : Point ) : Number
6. The byte order in the frame ByteArray is now taken care of by the ANE
You might not actually need to apply a rotation filter if you just want a correction for the device orientation. Doing that in AS3 is pretty quick (apply matrix to preview image) and, depending on how you encode your video, you might only need to set the video’s orientation information rather than physically rotate the frames. How do you do the encoding?
Good luck with your app! What’s it called?
Cheers,
Radoslava