This native extension is still in work, so please be careful when including in your project!
At the moment it is available only for iOS, but it is planned to extend this project to work for Android devices as well.
The example shows how to use the extension and uses these aspects:
- Getting the default thumbnail dimensions
- Loading a set of thumbnails by index and offset
- Loading a set of thumbnails by their URLs
- Loading a fullscreen image by the URL of the thumbnail metadata when clicking on a thumbnail
The following functions are available:
Returns: A Singleton instance of CameraRollExtension
Returns: A Boolean saying if this ANE can be used (true for iOS and Android devices)
Called internally after the extension context has been created
If at least one image exists in CameraRoll the thumbnail dimensions are determined. Since this is an async
call you have to register these two listeners:
PhotoAppEvent.EVENT_DEFAULT_THUMBNAIL_DIMENSIONS_LOADED → event.data contains a PhotoDimensions object
PhotoAppEvent.EVENT_DEFAULT_THUMBNAIL_DIMENSIONS_NOT_LOADED → normally no image has been found in CameraRoll
Gets the dimensions for the just loaded single photo asset of type thumbnail.
Async call for getting the number of images in CameraRoll. Register this listener for getting notified:
PhotoAppEvent.EVENT_COUNT_PHOTOS → event.data contains the count as a String
Async loads a number of photo assets (incl. some metadata) with offset startIndex of either type thumbnail (LOAD_PHOTO_TYPE_THUMBNAILS) or aspectRatioThumbnail (LOAD_PHOTO_TYPE_ASPECT_RATIO_THUMBNAILS).
Register this listener for being notified about loading the list of images: PhotoAppEvent.EVENT_THUMBS_LOADED → event.data contains an Array of PhotoObject objects,
where ‘photo’ contains the loaded BitmapData and metadata a PhotoMetadata object.
Async loads a number of photo assets for the passed list of url’s of either type thumbnail (LOAD_PHOTO_TYPE_THUMBNAILS) or aspectRatioThumbnail (LOAD_PHOTO_TYPE_ASPECT_RATIO_THUMBNAILS).
Register this listener for being notified about loading the list of images: PhotoAppEvent.EVENT_THUMBS_FOR_URLS_LOADED → event.data contains an Array of PhotoObject objects,
where ‘photo’ contains the loaded BitmapData and metadata a PhotoMetadata object.
Async loads one photo asset (incl. some metadata) for the given url and the type thumbnail.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_THUMBNAIL_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_THUMBNAIL_IMAGE_NOT_LOADED
Async loads one photo asset for the given url and the type fullscreen.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_FULL_SCREEN_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_FULL_SCREEN_IMAGE_NOT_LOADED
Async loads one photo asset for the given url and the type fullresolution.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_FULL_RESOLUTION_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_FULL_RESOLUTION_IMAGE_NOT_LOADED
Async loads one photo asset from CameraRoll for the given CameraRoll index and the type thumbnail.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_THUMBNAIL_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_THUMBNAIL_IMAGE_NOT_LOADED
Async loads one photo asset from CameraRoll for the given CameraRoll index and the type fullscreen.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_FULL_SCREEN_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_FULL_SCREEN_IMAGE_NOT_LOADED
Async loads one photo asset from CameraRoll for the given CameraRoll index and the type fullresolution.
Register these two listeners to be notified:
PhotoAppEvent.EVENT_FULL_RESOLUTION_IMAGE_LOADED → event.data contains the loaded image in a PhotoObject object
PhotoAppEvent.EVENT_FULL_RESOLUTION_IMAGE_NOT_LOADED
Sync loads metadata for the just loaded photo assets.
Be careful: This call doesn’t load photo assets, therefore you have to load them before that call!
Sync loads metadata for the just loaded photo asset.
Be careful: This call doesn’t load photo assets, therefore you have to load it before that call!
This ANE has been written in combination with a iPhone app to get better support for that device’s images in CameraRoll.
The app offers a paging mechanism when the user wants to see more images than fit on one device screen.
It is NOT RECOMMENDED to use this ANE when you want to load all existing images in CameraRoll in one step. The app could
crash in such a circumstance due to memory issues.
The iOS project has been built against iOS 4.3 Deployment Target.
If you encounter problems or see improvements for stability and/or performance please fork this project or let me know by leaving a message.
If you think this ANE is useful i would be grateful for a donation.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2013 by Valentin Treu, released under the MIT license.