Skip to content
Titanium SDK
Version13.1.0

You are reading 13.1.0. See this page in 13.4.1.

Titanium.UI.iOS.LivePhotoView

viewiPhoneiPadmacOSsince iPhone 5.2.0, iPad 5.2.0, macOS 9.2.0

Extends Titanium.UI.ViewTitanium.Proxy

A view to display a Titanium.UI.iOS.LivePhoto object introduced in iOS 9.1.

Use the Titanium.UI.iOS.createLivePhotoView method to create an new LivePhotoView.

Specifying either a width or height property for this view will scale its livePhoto with the aspect ratio maintained, up to a maximum size that does not exceed its parent view.

For more infos on Live Photo's, refer to the official Apple documentation.

Examples

Basic LivePhotoView

The following example shows how to create a simple Ti.UI.iOS.LivePhotoView:

var window = Ti.UI.createWindow({
    backgroundColor: "white"
});

var btn1 = Ti.UI.createButton({
    title: "Select live photo!",
    top: 30
});

btn1.addEventListener("click", openGallery);
window.add(btn1);
window.open();

function openGallery() {
    Ti.Media.openPhotoGallery({
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO, Ti.Media.MEDIA_TYPE_LIVEPHOTO],
        success: function(e) {
            var livePhoto = e.livePhoto // Live photo of type Ti.UI.iOS.LivePhoto

            if (livePhoto) {
                var livePhotoView = Ti.UI.iOS.createLivePhotoView({
                    livePhoto: livePhoto,
                    muted: true,
                    width: 300
                });

                livePhotoView.addEventListener("start", function(e) {
                    Ti.API.warn("-- Start playback --");
                    Ti.API.warn(e);
                });

                livePhotoView.addEventListener("stop", function(e) {
                    Ti.API.warn("-- Stop playback --");
                    Ti.API.warn(e);
                });
              window.add(livePhotoView);
            }
        }
    });
}

Properties 49

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

Inherited from Titanium.UI.View

A background gradient for the view.

Linear and Radial Gradients

The following code excerpt creates two views, one with a linear gradient and one with a radial gradient.

var win1 = Titanium.UI.createWindow({
    title:'Tab 1',
    backgroundColor:'#fff',
    layout: 'vertical'
});

var radialGradient = Ti.UI.createView({
    top: 10,
    width: 100,
    height: 100,
    backgroundGradient: {
        type: 'radial',
        startPoint: { x: 50, y: 50 },
        endPoint: { x: 50, y: 50 },
        colors: [ 'red', 'blue'],
        startRadius: 50,
        endRadius: 0,
        backfillStart: true
    }
});
var linearGradient = Ti.UI.createView({
    top: 10,
    width: 100,
    height: 100,
    backgroundGradient: {
        type: 'linear',
        startPoint: { x: '0%', y: '50%' },
        endPoint: { x: '100%', y: '50%' },
        colors: [ { color: 'red', offset: 0.0}, { color: 'blue', offset: 0.25 }, { color: 'red', offset: 1.0 } ],
    }
});
win1.add(radialGradient);
win1.add(linearGradient);
win1.open();

borderRadius

Number | String | Array<Number> | Array<String>

Inherited from Titanium.UI.View

Radius for the rounded corners of the view's border.

Default: 0

bubbleParent

Booleansince Android 3.0.0, iPhone 3.0.0, iPad 3.0.0, macOS 9.2.0

Inherited from Titanium.Proxy

Indicates if the proxy will bubble an event to its parent.

Default: true

layout

String

Inherited from Titanium.UI.View

Specifies how the view positions its children. One of: 'composite', 'vertical', or 'horizontal'.

left

Number | String

Inherited from Titanium.UI.View

View's left position, in platform-specific units.

The Live Photo displayed in the view.

You receive a new live photo object by selecting an existing photo from the photo gallery. Note: iOS 9.1 only allows to select existing photos from the gallery, capturing new live photos is not supported by the iOS public API, yet.

muted

Boolean

A Boolean value that determines whether the view plays the audio content of its Live Photo.

The default value is false, indicating that the view plays audio content along with the motion content of its Live Photo. Change this value to true to play motion content but not audio content.

Default: false

opacity

Number

Inherited from Titanium.UI.View

Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). Defaults to 1.0 (opaque).

rect

DimensionWithAbsolutessince 2.0.0read-only

Inherited from Titanium.UI.View

The bounding box of the view relative to its parent, in system units.

rotation

NumberiPhoneiPadsince Android 5.4.0, iPhone 12.3.0, iPad 12.3.0

Inherited from Titanium.UI.View

Clockwise 2D rotation of the view in degrees.

tooltip

Stringsince 12.1.0iOS 15.0+

Inherited from Titanium.UI.View

The default text to display in the control's tooltip.

Methods 18

Inherited from Titanium.UI.View

Adds a child to this view's hierarchy.

Parameters
ParametersTypeDescription
viewTitanium.UI.View | Array<Titanium.UI.View>

View to add to this view's hierarchy.

You may pass an array of views, e.g. view.add([subview1, subview2].

Inherited from Titanium.Proxy

Adds the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

convertPointToView

since Android 1.8, iPhone 1.8, iPad 1.8, macOS 9.2.0

Inherited from Titanium.UI.View

Translates a point from this view's coordinate system to another view's coordinate system.

Parameters
ParametersTypeDescription
pointPoint

A point in this view's coordinate system.

If this argument is missing an x or y property, or the properties can not be converted into numbers, an exception will be raised.

destinationViewTitanium.UI.View

View that specifies the destination coordinate system to convert to. If this argument is not a view, an exception will be raised.

Returns Point

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

Name of the event.

event?Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

getViewById

since 6.1.0

Inherited from Titanium.UI.View

Returns the matching view of a given view ID.

Parameters
ParametersTypeDescription
idString

The ID of the view that should be returned. Use the id property in your views to enable it for indexing in this method.

Inherited from Titanium.UI.View

Hides this view.

Parameters
ParametersTypeDescription
options?AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and used only on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

insertAt

since 3.3.0

Inherited from Titanium.UI.View

Inserts a view at the specified position in the children array.

Parameters
ParametersTypeDescription
paramsViewPositionOptions

Pass an object that specifies the view to insert and optionally at which position (defaults to end)

2 fields
position? Number

Position in the children array of the view element to replace.

view Titanium.UI.View

View to insert. Required.

Inherited from Titanium.Proxy

Removes the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

replaceAt

since 3.3.0

Inherited from Titanium.UI.View

Replaces a view at the specified position in the children array.

Parameters
ParametersTypeDescription
paramsViewPositionOptions

Pass an object with the view to insert and the position of the view to replace. In this case the position property is required.

2 fields
position? Number

Position in the children array of the view element to replace.

view Titanium.UI.View

View to insert. Required.

Inherited from Titanium.UI.View

Makes this view visible.

Parameters
ParametersTypeDescription
options?AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and only used on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

Begins playback of Live Photo content in the view.

Use the playbackStyle parameter to choose whether to play the full motion and sound content of the Live Photo or only a brief section.

Typically, an app does not need to directly control playback, because a Live Photo view provides interactive playback control. Use this method only when non-interactive playback is appropriate-for example, to briefly animate the content to indicate that a view contains a Live Photo rather than a still image.

Parameters
ParametersTypeDescription
playbackStyleNumber

An option for how much of the Live Photo's motion and sound content to play.

Ends playback of Live Photo content in the view.

Inherited from Titanium.UI.View

Returns an image of the rendered view, as a Blob.

Parameters
ParametersTypeDescription
callback?Callback<Titanium.Blob>

Function to be invoked upon completion. If non-null, this method will be performed asynchronously. If null, it will be performed immediately.

honorScaleFactor?Boolean

Determines whether the image is scaled based on scale factor of main screen. (iOS only)

When set to true, image is scale factor is honored. When set to false, the image in the blob has the same dimensions for retina and non-retina devices.

Events 4

keypressed

since Android 3.1.0, iPhone 5.4.0, iPad 5.4.0, macOS 9.2.0

Inherited from Titanium.UI.View

Fired when a hardware key is pressed in the view.

Event properties
Event propertiesTypeDescription
keyCodeNumber

The code for the physical key that was pressed. For more details, see KeyEvent. This API is experimental and subject to change.

rotate

since 12.7.0

Inherited from Titanium.UI.View

Fired when the device detects a two finger rotation.

Event properties
Event propertiesTypeDescription
rotateNumber

Rotation in degrees.

Fired when the Live Photo playback starts.

Event properties
Event propertiesTypeDescription
playbackStyleNumber

Returns the playbackStyle that was provided to start the playback.

Fired when the Live Photo playback stops.

Event properties
Event propertiesTypeDescription
playbackStyleNumber

Returns the playbackStyle that was provided to start the playback.