Titanium.Media with location and EXIF data!
Objective-C Python JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
Classes
assets
documentation
example
hooks
mymedia.xcodeproj
platform
.gitignore
.project
CHANGELOG.txt
LICENSE
LICENSE.txt
MyMedia_Prefix.pch
README.md
build.py
manifest
module.xcconfig
timodule.xml
titanium.xcconfig

README.md

myMedia Module

A hacked version of Ti.Media so that Ti.Media.openPhotoGallery provides location and EXIF data in the success callback

EXIF data Location data EXIF data Photo

Description

This module was created to be used in place of Ti.Media.openPhotoGallery when location and EXIF data is needed from the Photo Gallery.

Accessing the mymedia Module

  1. Make sure the path to your Titanium Mobile SDK in titanium.xcconfig is correct. The ~ denotes your home directory. You may have to remove the ~ if the SDK is not installed there.

    TITANIUM_SDK = ~/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)

  2. Build the module:

    ./build.py

  3. Copy my.media-iphone-X.X.zip (where X.X is the version) to the ROOT of your project (same directory as tiapp.xml)

  4. Add the module to the tiapp.xml file:

	<modules>
		<module platform="iphone" version="0.1">my.media</module>
    </modules>
  1. To access this module from JavaScript, you would do the following:

    var mymedia = require("my.media");

The mymedia variable is a reference to the Module object.

Reference

mymedia.openPhotoGallery(PhotoGalleryOptionsType options)

Parameters

Returns

  • void

Usage

mymedia.openPhotoGallery({
	success:function(e) {
		if (e.mediaType === Ti.Media.MEDIA_TYPE_PHOTO) {
			Ti.API.debug("Photo was uploaded");
		}
		Ti.API.debug('openPhotoGallery SUCCESS: ' + JSON.stringify(e));
		if (e.metadata) {
			var dialog = Ti.UI.createAlertDialog({
				message: e.metadata,
				ok: 'OK',
				title: 'Metadata'
			}).show();
		}
	},
	cancel:function() {
		Ti.API.debug("openPhotoGallery CANCEL");
	},
	error:function(error) {
		Ti.API.error("openPhotoGallery ERROR: " + JSON.stringify(error));
	},
	animated:true,
	allowEditing:true,
	videoMaximumDuration:15000, // 15 seconds
	videoQuality: Ti.Media.QUALITY_MEDIUM,
	mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_VIDEO]
});

Author

David Knell (Twitter: dknell)

License

Apache Public License 2.0