Skip to content
Titanium SDK
Version13.1.1

You are reading 13.1.1. See this page in 13.4.1.

Titanium.Media.VideoPlayer

viewAndroidiPhoneiPadmacOSsince 0.9

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 scalingMode set 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

allowsAirPlay

BooleaniPhoneiPadmacOSiOS 4.3+

Whether or not the current movie can be played on a remote device.

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.

autoHide

BooleanAndroidsince 12.1.0

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

Boolean

Indicates 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

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();

backgroundView

Titanium.UI.ViewdeprecatediPhoneiPadmacOS

Deprecated since 7.0.0

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.

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

duration

Number

The 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

elevation

NumberAndroidsince 5.0.0Android 5+

Inherited from Titanium.UI.View

Base elevation of the view relative to its parent in pixels.

The 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

fairPlayConfiguration

FairPlayConfigurationiPhoneiPadmacOSsince 12.2.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.

focusable

BooleanAndroid

Inherited from Titanium.UI.View

Whether view should be focusable while navigating with the trackball.

Default: false

fullscreen

BooleandeprecatedAndroid

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

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.

naturalSize

MovieSizeiPhoneiPadmacOS

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

Number

Inherited 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',
});

pictureInPictureEnabled

BooleaniPhoneiPadmacOS

Whether or not the receiver allows Picture in Picture playback.

Default: true

playableDuration

Numberread-only

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

playing

Booleanread-only

Boolean to indicate if the player has started playing.

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

NumberAndroidiPhoneiPadsince 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.

showsControls

Booleansince Android 7.1.0, iPhone 7.0.0, iPad 7.0.0, macOS 9.2.0

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

speed

NumberAndroidsince 12.4.0

Playback speed of the video.

Playback speed of the video. Android: only available for API level >= 23.

tooltip

Stringsince 12.1.0iOS 15.0+

Inherited from Titanium.UI.View

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

touchFeedback

BooleanAndroidsince 6.1.0

Inherited from Titanium.UI.View

A material design visual construct that provides an instantaneous visual confirmation of touch point.

Default: false

translationX

NumberAndroidsince 5.0.0

Inherited from Titanium.UI.View

Horizontal location of the view relative to its left position in pixels.

url

String

URL of the media to play.

URL identifying a local or remote video to play.

volume

Numbersince 2.1

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

Methods 23

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.

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.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.

Asynchronously 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
ParametersTypeDescription
timesArray<Number>

Array of time values, representing offsets into the video, in seconds.

optionNumber

Video time precision.

callbackCallback<ThumbnailResponse>

Callback to invoke when a thumbnail is available.

3 fields
code Number

Error code. Returns 0 if success is true.

image Titanium.Blob

Thumbnail image, as a Blob.

time Number

Time offset for the thumbnail, in seconds.

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 }

Stops playing the video.

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 23

click

Android

Fired 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
Event propertiesTypeDescription
yNumber

Y coordinate of the event from the source view's coordinate system.

xNumber

X coordinate of the event from the source view's coordinate system.

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
Event propertiesTypeDescription
reasonNumber

Reason that playback ended.

successBoolean

Indicates if the video was played successfully. User exit counts as a success. Returns true if reason is not VIDEO_FINISH_REASON_PLAYBACK_ERROR, false otherwise.

errorString

Error message, if any returned. Will be undefined if success is true.

codeNumber

Error code. Error code will be 0 if success is true, nonzero otherwise. If the error was generated by the operating system, that system's error value is used. Otherwise, this value will be -1.

Inherited from Titanium.UI.View

Fired when the device detects a double click against the view.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the double click passed through an overlapping window belonging to another app.

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
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the double tap passed through an overlapping window belonging to another app.

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 video duration is available.

Event properties
Event propertiesTypeDescription
durationNumber

Video duration, in milliseconds.

Fired when movie playback encounters an error.

Event properties
Event propertiesTypeDescription
messageString

Reason for error as a string.

successBoolean

Indicates a successful operation. Returns false.

errorString

Error message, if any returned. May be undefined.

codeNumber

Error code. If the error was generated by the operating system, that system's error value is used. Otherwise, this value will be -1.

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.

Fired when the movie play loads.

Fired when the network loadState changes.

Event properties
Event propertiesTypeDescription
loadStateNumber

Current value of the loadState property.

Inherited from Titanium.UI.View

Fired when the device detects a long press.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

obscuredBoolean

Returns true if the long press passed through an overlapping window belonging to another app.

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.

naturalsizeavailable

iPhoneiPadmacOSsince 3.0.0

Fired when the natural size of the current movie is determined.

Event properties
Event propertiesTypeDescription
naturalSizeNumber

Current value of the naturalSize property.

Fired when the currently playing movie changes.

Event properties
Event propertiesTypeDescription
urlString

URL of the media.

preload

Android

Fired when the movie has preloaded and is ready to play.

resize

iPhoneiPadmacOS

Fired when the movie player is resized.

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.

singletap

Android

Fired when the device detects a single tap against the view.

Event properties
Event propertiesTypeDescription
yNumber

Y coordinate of the event from the source view's coordinate system.

xNumber

X coordinate of the event from the source view's coordinate system.

Inherited from Titanium.UI.View

Fired when the device detects a swipe gesture against the view.

Event properties
Event propertiesTypeDescription
directionString

Direction of the swipe--either 'left', 'right', 'up', or 'down'.

xNumber

X coordinate of the event's endpoint from the source view's coordinate system.

yNumber

Y coordinate of the event's endpoint from the source view's coordinate system.

obscuredBoolean

Returns true if the swipe passed through an overlapping window belonging to another app.

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 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
Event propertiesTypeDescription
yNumber

Y coordinate of the event from the source view's coordinate system.

xNumber

X coordinate of the event from the source view's coordinate system.

touchend

Android

Fired 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
Event propertiesTypeDescription
yNumber

Y coordinate of the event from the source view's coordinate system.

xNumber

X coordinate of the event from the source view's coordinate system.

touchmove

Android

Fired 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
Event propertiesTypeDescription
yNumber

Y coordinate of the event from the source view's coordinate system.

xNumber

X coordinate of the event from the source view's coordinate system.

Inherited from Titanium.UI.View

Fired as soon as the device detects a touch gesture.

Event properties
Event propertiesTypeDescription
xNumber

X coordinate of the event from the source view's coordinate system.

yNumber

Y coordinate of the event from the source view's coordinate system.

forceNumber

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.

sizeNumber

The current size of the touch area. Note: This property is only available on some Android devices.

maximumPossibleForceNumber

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.

altitudeAngleNumber

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.

timestampNumber

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.

azimuthUnitVectorInViewXNumber

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.

azimuthUnitVectorInViewYNumber

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.

obscuredBoolean

Returns true if the touch passed through an overlapping window belonging to another app.

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.