You are reading 13.1.0. See this page in 13.4.1.
Titanium.Media.VideoPlayer
Extends Titanium.UI.ViewTitanium.Proxy
A native control for playing videos.
The video player is a native view that can be used to play videos, either stored locally or streamed from a web server. The player can occupy the full screen, or can be used as a view that can be added to other views.
Use the Titanium.Media.createVideoPlayer method to create a video player.
All platforms support specifying the video content as a URL, either to a local file or a remote stream. This is done by setting the url property.
iOS Implementation Notes
On iOS, video content can also be specified as a Blob or File object using the media property.
On iOS, a video player can dynamically switch back and forth between fullscreen mode and standard mode. If the native video controls are displayed, the user can use them to switch between standard and fullscreen mode.
Android Implementation Notes
On Android, the video player cannot switch modes. To create a fullscreen player, you
must specify fullscreen: true when you create the player. This fullscreen player
creates its own Android Activity on top of the activity stack.
Unlike a normal view, this fullscreen video player appears as soon as it is created.
The user can close the player by pressing the Back button. See the code examples for
a sample using the fullscreen player on Android.
There are several known issues with clipping on the Android video player.
-
When used with
scalingModeset to VIDEO_SCALING_ASPECT_FILL or VIDEO_SCALING_NONE, the video content is not correctly clipped to the boundaries of the view. (TIMOB-7628) -
When a border is set on the view, the video content does not take the border width into account, so the video content covers the border. (TIMOB-7628)
-
If a borderRadius is specified, the video content is not clipped to the rounded corners. (TIMOB-7629)
On Android, using a video player inside a scroll view is not recommended. When scrolling, black bars may appear over the video content.
This is because the video player is rendered on a special Android UI element called a SurfaceView. Android renders the SurfaceView behind the main window and punches a hole in the window to reveal the video. Because the content of the SurfaceView does not reside in the application window, the video content cannot be transformed (moved, scaled or rotated) with the window. This makes it difficult for the content to render properly inside a ScrollView.
Examples
Simple Video Player Example
The following code creates a simple video player to play a local video file.
var vidWin = Titanium.UI.createWindow({
title: 'Video View Demo',
backgroundColor: '#fff'
});
var videoPlayer = Titanium.Media.createVideoPlayer({
top: 2,
autoplay: true,
backgroundColor: 'blue',
height: 300,
width: 300,
mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode: Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT
});
videoPlayer.url = 'movie.mp4';
vidWin.add(videoPlayer);
vidWin.open();
Android Fullscreen Video Player
The Android fullscreen video player operates differently from other video players. The following example shows how to create, show, and close a fullscreen video player.
Note that in this example, a button is included to close the player, to demonstrate a method for dismissing the player programmatically. In practice, the user can always dismiss the player by using the Back button, so an on-screen control would not be required.
var win = Titanium.UI.createWindow({
title: 'Test',
backgroundColor: '#fff'
});
// Change to a valid URL
var contentURL = "http://www.example.com/stream.mp4";
var openButton = Ti.UI.createButton({
title: "Start Video",
top: "0dp",
height: "40dp",
left: "10dp",
right: "10dp"
});
openButton.addEventListener('click', function() {
var activeMovie = Titanium.Media.createVideoPlayer({
url: contentURL,
backgroundColor: 'blue',
mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode: Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT_FILL,
fullscreen: true,
autoplay: true
});
var closeButton = Ti.UI.createButton({
title: "Exit Video",
top: "0dp",
height: "40dp",
left: "10dp",
right: "10dp"
});
closeButton.addEventListener('click', function() {
activeMovie.hide();
activeMovie.release();
activeMovie = null;
});
activeMovie.add(closeButton);
});
win.add(openButton);
win.open();
Alloy XML Markup
Previous simple example as an Alloy view.
simplevideoplayer.xml:
<Alloy>
<Window id="vidWin" title="Video View Demo" backgroundColor="#fff">
<VideoPlayer id="videoPlayer" ns="Ti.Media" top="2" url="/movie.mp4"
height="300" width="300" backgroundColor="blue" autoplay="true" />
</Window>
</Alloy>
Properties 98
Inherited from Titanium.UI.View
Boolean value to remove the long press notification for the device's accessibility service.
Default: true
Inherited from Titanium.UI.View
Whether the view should be "hidden" from (i.e., ignored by) the accessibility service.
Default: false
Inherited from Titanium.UI.View
Briefly describes what performing an action (such as a click) on the view will do.
Default: null
Inherited from Titanium.UI.View
A succinct label identifying the view for the device's accessibility service.
Inherited from Titanium.UI.View
A string describing the value (if any) of the view for the device's accessibility service.
Whether or not the current movie can be played on a remote device.
Inherited from Titanium.UI.View
Coordinate of the view about which to pivot an animation.
Inherited from Titanium.UI.View
Current position of the view during an animation.
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Indicates if player is hidden by default and shown when its ready.
On Android the background of the video player is set to the primary background color.
When switching on autoHide it will hide the player until the video is loaded.
Then it will automatically show the player. In a Titanium.UI.ListView it will hide
it again when it is outside the viewport.
Default: false
autoplay
BooleanIndicates if a movie should automatically start playback.
On iOS, playback starts automatically if autoplay is true and the movie is likely to
finish uninterrupted. The OS determines whether the movie is likely to finish
uninterrupted based on factors including the bit rate of the movie and network
conditions (if the movie is being streamed from a remote source).
Default: true
backgroundColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Disabled background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Disabled background image for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Focused background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Focused background image for the view, specified as a local file path or URL.
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();
backgroundImage
StringInherited from Titanium.UI.View
Background image for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Size of the left end cap.
Default: 0
backgroundRepeat
BooleanInherited from Titanium.UI.View
Determines whether to tile a background across a view.
Default: false
backgroundSelectedColor
String | Titanium.UI.Colorsince Android 0.9, iPhone 13.1.0, iPad 13.1.0, macOS 13.1.0Inherited from Titanium.UI.View
Selected background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Selected background image URL for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Size of the top end cap.
Default: 0
Deprecated since 7.0.0
Use Titanium.Media.VideoPlayer.overlayView instead.
Sets the background view for customization which is always displayed behind movie content.
To create a background behind the movie content on iOS, you can specify a
background view. On iOS, you can set the backgroundColor property directly on
the video player, but not a background image or background gradient. For this kind
of effect, specify a background view.
Note that the background view must be sized explicitly: percentage sizes do not work properly.
The following code sample creates a video player with a background image:
var videoPlayer = Ti.Media.createVideoPlayer({
height: 300,
width: 300,
backgroundView: Ti.UI.createView({
backgroundImage: 'videoPlayerBG.png
width: 300,
height: 300
}),
borderRadius: 20,
borderWidth: 2,
borderColor: 'blue',
});
Note that if scalingMode is set to VIDEO_SCALING_RESIZE or VIDEO_SCALING_RESIZE_ASPECT_FILL, the playing video will fill the entire video player area, obscuring any background view.
borderColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Border color of the view, as a color name or hex triplet.
borderRadius
Number | String | Array<Number> | Array<String>Inherited from Titanium.UI.View
Radius for the rounded corners of the view's border.
Default: 0
borderWidth
NumberInherited from Titanium.UI.View
Border width of the view.
Default: 0
bottom
Number | StringInherited from Titanium.UI.View
View's bottom position, in platform-specific units.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
Inherited from Titanium.UI.View
View's center position, in the parent view's coordinates.
Inherited from Titanium.UI.View
Array of this view's child views.
Inherited from Titanium.UI.View
View's clipping behavior.
currentPlaybackTime
NumberCurrent playback time of the current movie in milliseconds.
duration
NumberThe duration of the current movie in milliseconds, or 0.0 if not known.
The duration of the movie may not be available when playback is started. The durationavailable event is fired when the duration is known.
Default: 0
Inherited from Titanium.UI.View
Base elevation of the view relative to its parent in pixels.
endPlaybackTime
NumberThe end time of movie playback, in milliseconds.
On iOS, defaults to 0, which indicates natural end time of the movie.
Changing the value to a value less than duration causes the movie to
stop playing at the specified point. On iOS, this value is not applicable to
streaming media, so 0 is returned if the current media is being streamed.
On Android, this is always the same as duration (the natural end time), and changing the value has no effect.
Default: 0
Handle DRM-encrypted video assets using the Apple FairPlay Streaming API.
Secure the delivery of streaming media to devices through the HTTP Live Streaming (HLS) protocol. Using FairPlay Streaming (FPS) technology, content providers, encoding vendors, and delivery networks can encrypt content, securely exchange keys, and protect playback on iOS, iPadOS and macOS.
Inherited from Titanium.UI.View
Discards touch related events if another app's system overlay covers the view.
Default: false
Inherited from Titanium.UI.View
Whether view should be focusable while navigating with the trackball.
Default: false
Deprecated since 7.0.0
This property has been removed for iOS in Titanium SDK 7.0.0 as of the official deprecation by Apple.
Determines if the movie is presented in the entire screen (obscuring all other application content).
Note that this must be set at different times on different platforms:
On Android, this property must be set at creation time. For example:
var player = Ti.Media.createVideoPlayer({fullscreen: true});
On Android, setting this value to true means that the video will have its own Android Activity
rather than being embedded as a view.
This property was removed on iOS in SDK 7.0.0
Default: false
height
Number | StringInherited from Titanium.UI.View
View height, in platform-specific units.
Inherited from Titanium.UI.View
Adds a horizontal parallax effect to the view
Inherited from Titanium.UI.View
Determines whether the layout has wrapping behavior.
Default: true
id
StringInherited from Titanium.UI.View
View's identifier.
initialPlaybackTime
NumberThe start time of movie playback, in milliseconds.
Default: 0
Inherited from Titanium.UI.View
Determines whether to keep the device screen on.
Default: false
layout
StringInherited from Titanium.UI.View
Specifies how the view positions its children. One of: 'composite', 'vertical', or 'horizontal'.
left
Number | StringInherited from Titanium.UI.View
View's left position, in platform-specific units.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
Deprecated since 7.0.0
On iOS, use Titanium.Media.VideoPlayer.moviePlayerStatus instead.
Returns the network load state of the movie player.
Media object to play, as either a Ti.Filesystem.File, a Ti.Blob, or an URL String.
Deprecated since 7.0.0
On iOS, use Titanium.Media.VideoPlayer.showsControls instead.
The style of the playback controls.
Removed from iOS in SDK 7.0.0
Default: System default video controls (<Titanium.Media.VIDEO_CONTROL_DEFAULT>).
The type of media in the player's current item first track.
Accepts 10 constants
Default: <Titanium.Media.VIDEO_MEDIA_TYPE_VIDEO>
Returns the status of the movie player.
Returns the natural size of the movie.
Returns a dictionary with properties width and height. Returns 0 for both properties if not
known or applicable.
The naturalSizeAvailable event is fired when the natural size is known.
opacity
NumberInherited from Titanium.UI.View
Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). Defaults to 1.0 (opaque).
Use the overlay view to add additional custom views between the video content and the controls.
Note that the overlay view must be sized explicitly: percentage sizes do not work properly.
The following code sample creates a video player with a background image:
var videoPlayer = Ti.Media.createVideoPlayer({
height : 300,
width : 300,
overlayView : Ti.UI.createView({
backgroundImage: 'videoPlayerBG.png
width : 300,
height : 300
}),
borderRadius : 20,
borderWidth : 2,
borderColor : 'blue',
});
Inherited from Titanium.UI.View
When on, animate call overrides current animation if applicable.
Whether or not the receiver allows Picture in Picture playback.
Default: true
Currently playable duration of the movie, in milliseconds, for progressively downloaded network content, or 0.0 if not known.
On Android, this is always the same as duration.
Default: 0
Current playback state of the video player.
One of the VIDEO_PLAYBACK_STATE constants defined in Titanium.Media.
Boolean to indicate if the player has started playing.
Inherited from Titanium.UI.View
The preview context used in the 3D-Touch feature "Peek and Pop".
Inherited from Titanium.UI.View
Background color of the wrapper view when this view is used as either Titanium.UI.ListView.pullView or Titanium.UI.TableView.headerPullView.
Defaults to undefined. Results in a light grey background color on the wrapper view.
Inherited from Titanium.UI.View
The bounding box of the view relative to its parent, in system units.
Determines how the movie player repeats when reaching the end of playback.
Default: Titanium.Media.VIDEO_REPEAT_MODE_NONE
right
Number | StringInherited from Titanium.UI.View
View's right position, in platform-specific units.
Inherited from Titanium.UI.View
Clockwise 2D rotation of the view in degrees.
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (x-axis).
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (y-axis).
Inherited from Titanium.UI.View
Scaling of the view in x-axis in pixels.
Inherited from Titanium.UI.View
Scaling of the view in y-axis in pixels.
scalingMode
NumberDetermines how the content scales to fit the view.
Default: <Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT> on Android, <Titanium.Media.VIDEO_SCALING_RESIZE> on iOS
Whether or not the receiver shows playback controls. Default is true.
Clients can set this property to false when they don't want to have any playback controls on top of the visual content (e.g. for a game splash screen). This property should not be used to temporarily change the visibility of the playback controls since it will create or destroy UI elements.
Default: true
Inherited from Titanium.UI.View
The size of the view in system units.
Inherited from Titanium.UI.View
Determines keyboard behavior when this view is focused. Defaults to Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS.
Playback speed of the video.
Playback speed of the video. Android: only available for API level >= 23.
Inherited from Titanium.UI.View
The view's tintColor
Default: null
Inherited from Titanium.UI.View
The default text to display in the control's tooltip.
top
Number | StringInherited from Titanium.UI.View
The view's top position.
touchEnabled
BooleanInherited from Titanium.UI.View
Determines whether view should receive touch events.
Default: true
Inherited from Titanium.UI.View
A material design visual construct that provides an instantaneous visual confirmation of touch point.
Default: false
Inherited from Titanium.UI.View
Optional touch feedback ripple color. This has no effect unless touchFeedback is true.
Inherited from Titanium.UI.View
Transformation matrix to apply to the view.
Default: Identity matrix
Inherited from Titanium.UI.View
A name to identify this view in activity transition.
Inherited from Titanium.UI.View
Horizontal location of the view relative to its left position in pixels.
Inherited from Titanium.UI.View
Vertical location of the view relative to its top position in pixels.
Inherited from Titanium.UI.View
Depth of the view relative to its elevation in pixels.
url
StringURL of the media to play.
URL identifying a local or remote video to play.
Inherited from Titanium.UI.View
Adds a vertical parallax effect to the view
viewShadowColor
String | Titanium.UI.Colorsince Android 11.1.0, iPhone 3.3.0, iPad 3.3.0, macOS 9.2.0Inherited from Titanium.UI.View
Determines the color of the shadow.
Inherited from Titanium.UI.View
Determines the offset for the shadow of the view.
Inherited from Titanium.UI.View
Determines the blur radius used to create the shadow.
visible
BooleanInherited from Titanium.UI.View
Determines whether the view is visible.
Default: true
Volume of the audio portion of the video.
On iOS, this adjusts the volume of the application's session as well, and will not work if useApplicationAudioSession has been set false. On the iOS device, setting this will be accompanied by an OS-provided indicator. However, the iOS simulator does not honor this volume setting, and is a known issue with Apple's simulator.
Default: 1
width
Number | StringInherited from Titanium.UI.View
View's width, in platform-specific units.
zIndex
NumberInherited from Titanium.UI.View
Z-index stack order position, relative to other sibling views.
Methods 23
Inherited from Titanium.UI.View
Adds a child to this view's hierarchy.
| Parameters | Type | Description |
|---|---|---|
| view | Titanium.UI.View | Array<Titanium.UI.View> | View to add to this view's hierarchy. You may pass an array of views, e.g. |
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
Inherited from Titanium.UI.View
Animates this view.
| Parameters | Type | Description |
|---|---|---|
| animation | Titanium.UI.Animation | Dictionary<Titanium.UI.Animation> | Either a dictionary of animation properties or an Animation object. |
| callback? | Callback<Object> | Function to be invoked upon completion of the animation. |
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
cancelAllThumbnailImageRequests
since 3.6.0Cancels all pending asynchronous thumbnail requests.
Asynchronous thumbnail requests initiated with requestThumbnailImagesAtTimes.
Inherited from Titanium.UI.View
Removes all previously added motion effects.
convertPointToView
since Android 1.8, iPhone 1.8, iPad 1.8, macOS 9.2.0Inherited from Titanium.UI.View
Translates a point from this view's coordinate system to another view's coordinate system.
| Parameters | Type | Description |
|---|---|---|
| point | Point | A point in this view's coordinate system. If this argument is missing an |
| destinationView | Titanium.UI.View | View that specifies the destination coordinate system to convert to. If this argument is not a view, an exception will be raised. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | 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.0Inherited from Titanium.UI.View
Returns the matching view of a given view ID.
| Parameters | Type | Description |
|---|---|---|
| id | String | The ID of the view that should be returned. Use the |
Inherited from Titanium.UI.View
Hides this view.
| Parameters | Type | Description |
|---|---|---|
| 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 |
insertAt
since 3.3.0Inherited from Titanium.UI.View
Inserts a view at the specified position in the children array.
| Parameters | Type | Description |
|---|---|---|
| params | ViewPositionOptions | Pass an object that specifies the view to insert and optionally at which position (defaults to end) 2 fields
|
Pauses playing the video.
Starts playing the video.
Releases the internal video resources immediately.
This is not usually necessary but can help if you no longer need to use the player after it is used to help converse memory.
Inherited from Titanium.UI.View
Removes a child view from this view's hierarchy.
| Parameters | Type | Description |
|---|---|---|
| view | Titanium.UI.View | View to remove from this view's hierarchy. |
removeAllChildren
since 3.1.0Inherited from Titanium.UI.View
Removes all child views from this view's hierarchy.
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|
replaceAt
since 3.3.0Inherited from Titanium.UI.View
Replaces a view at the specified position in the children array.
| Parameters | Type | Description |
|---|---|---|
| params | ViewPositionOptions | Pass an object with the view to insert and the position of the view to replace. In this case the 2 fields
|
requestThumbnailImagesAtTimes
since 3.6.0Asynchronously request thumbnail images for one or more points in time in the video.
The times parameter specifies an array of time values, in
seconds. For each time value, the platform generates an image
representing the video at that point in time.
The callback function is invoked when a thumbnail is available.
Calling this method will cancel all pending asynchronous thumbnail requests.
| Parameters | Type | Description |
|---|---|---|
| times | Array<Number> | Array of time values, representing offsets into the video, in seconds. |
| option | Number | Video time precision. |
| callback | Callback<ThumbnailResponse> | Callback to invoke when a thumbnail is available. 3 fields
|
Inherited from Titanium.UI.View
Makes this view visible.
| Parameters | Type | Description |
|---|---|---|
| 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 |
Stops playing the video.
Inherited from Titanium.UI.View
Stops a running animation.
Inherited from Titanium.UI.View
Returns an image of the rendered view, as a Blob.
| Parameters | Type | Description |
|---|---|---|
| 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 23
click
AndroidFired when the device detects a click against the view.
There is a subtle difference between singletap and click events.
A singletap event is generated when the user taps the screen briefly without moving their finger. This gesture will also generate a click event.
However, a click event can also be generated when the user touches, moves their finger, and then removes it from the screen.
On Android, a click event can also be generated by a trackball click.
| Event properties | Type | Description |
|---|---|---|
| y | Number | Y coordinate of the event from the |
| x | Number | X coordinate of the event from the |
Fired when movie playback ends or a user exits playback.
On iOS, the reason property is only included if this information is available.
| Event properties | Type | Description |
|---|---|---|
| reason | Number | Reason that playback ended. |
| success | Boolean | Indicates if the video was played successfully. User exit counts as a success.
Returns |
| error | String | Error message, if any returned. Will be undefined if |
| code | Number | Error code.
Error code will be 0 if |
Inherited from Titanium.UI.View
Fired when the device detects a double click against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a double tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
durationavailable
since 3.0.0Fired when the video duration is available.
| Event properties | Type | Description |
|---|---|---|
| duration | Number | Video duration, in milliseconds. |
Fired when movie playback encounters an error.
| Event properties | Type | Description |
|---|---|---|
| message | String | Reason for error as a string. |
| success | Boolean | Indicates a successful operation. Returns |
| error | String | Error message, if any returned. May be |
| code | Number | Error code.
If the error was generated by the operating system, that system's error value
is used. Otherwise, this value will be |
keypressed
since Android 3.1.0, iPhone 5.4.0, iPad 5.4.0, macOS 9.2.0Inherited from Titanium.UI.View
Fired when a hardware key is pressed in the view.
| Event properties | Type | Description |
|---|---|---|
| keyCode | Number | The code for the physical key that was pressed. For more details, see KeyEvent. This API is experimental and subject to change. |
Fired when the movie play loads.
Fired when the network loadState changes.
| Event properties | Type | Description |
|---|---|---|
| loadState | Number | Current value of the loadState property. |
Inherited from Titanium.UI.View
Fired when the device detects a long press.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Fired when the natural size of the current movie is determined.
| Event properties | Type | Description |
|---|---|---|
| naturalSize | Number | Current value of the naturalSize property. |
playbackstate
since 3.0.0Fired when the playbackState changes.
| Event properties | Type | Description |
|---|---|---|
| playbackState | Number | Current value of the playbackState property. |
Fired when the currently playing movie changes.
| Event properties | Type | Description |
|---|---|---|
| url | String | URL of the media. |
postlayout
since 2.0.0Inherited from Titanium.UI.View
Fired when a layout cycle is finished.
preload
AndroidFired when the movie has preloaded and is ready to play.
resize
iPhoneiPadmacOSFired when the movie player is resized.
rotate
since 12.7.0Inherited from Titanium.UI.View
Fired when the device detects a two finger rotation.
| Event properties | Type | Description |
|---|---|---|
| rotate | Number | Rotation in degrees. |
singletap
AndroidFired when the device detects a single tap against the view.
| Event properties | Type | Description |
|---|---|---|
| y | Number | Y coordinate of the event from the |
| x | Number | X coordinate of the event from the |
Inherited from Titanium.UI.View
Fired when the device detects a swipe gesture against the view.
| Event properties | Type | Description |
|---|---|---|
| direction | String | Direction of the swipe--either 'left', 'right', 'up', or 'down'. |
| x | Number | X coordinate of the event's endpoint from the |
| y | Number | Y coordinate of the event's endpoint from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
touchcancel
AndroidFired when a touch event is interrupted by the device.
A touchcancel can happen in circumstances such as an incoming call to allow the UI to clean up state.
| Event properties | Type | Description |
|---|---|---|
| y | Number | Y coordinate of the event from the |
| x | Number | X coordinate of the event from the |
touchend
AndroidFired when a touch event is completed.
On the Android platform, other gesture events, such as longpress or swipe, cancel touch events,
so this event may not be triggered after a touchstart event.
| Event properties | Type | Description |
|---|---|---|
| y | Number | Y coordinate of the event from the |
| x | Number | X coordinate of the event from the |
touchmove
AndroidFired as soon as the device detects movement of a touch.
Event coordinates are always relative to the view in which the initial touch occurred
| Event properties | Type | Description |
|---|---|---|
| y | Number | Y coordinate of the event from the |
| x | Number | X coordinate of the event from the |
Inherited from Titanium.UI.View
Fired as soon as the device detects a touch gesture.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |