In this blog post I’ll walk you through all of this using the new Titanium 5.2.0 Sample App:
Although Apple’s Reference isn’t really clear about it does say:
Live Photos is a Camera app feature on supported devices …
And that has indeed been our experience and that of app developers that work directly in Objective-C or Swift. Even when we do include the Live Photo media type, the UI for taking a new photo within another app will not include the Live icon and does not return a Live Photo. We will provide support soon after Apple does.
To select a Live Photo from your device you use Ti.Media.openPhotoGallery() as always. Live Photos will always be selectable, but only if you include
Ti.Media.MEDIA_TYPE_LIVEPHOTO in the mediaTypes will you get an actual livePhoto in the success response. Both ways, the existing media property will always get you the plain photo.
NOTE: You cannot use
Ti.Media.MEDIA_TYPE_LIVEPHOTOwithout also including
See the the Sample App’s livephoto.js controller for the implementation.
Live Photos cannot be displayed in a
Ti.UI.ImageView, but only the new Ti.UI.iOS.LivePhotoView.
<LivePhotoView ns="Ti.UI.iOS" .. />
The view supports force touch interaction with the Live Photo out of the box. Just force touch the view to play the Live Photo.
You can also programmatically start and stop the playback. Use Ti.UI.iOS.LivePhotoView.startPlaybackWithStyle() to start and stopPlayback() to cancel. The first method accepts a parameter to select full playback or the hint style that you also see as a LivePhoto scrolls into view in the Photos app. This is also the only use case that Apple suggests you should use this method for.
In the livephoto.js controller we playback with hint style after we’ve initialised the LivePhotoView with the Live Photo you selected: