A native control for playing videos for Titanium. Based on Google ExoPlayer, using Titanium.Media.VideoPlayer API.
To access this module from JavaScript, you would do the following:
var ExoPlayer = require("ru.netris.mobile.exoplayer");
The ExoPlayer
variable is a reference to the Module object.
ExoPlayer.createVideoPlayer
:Titanium.Media.createVideoPlayer
ExoPlayer.DEFAULT_PLAYBACK_PARAMETERS
: PlaybackParameters.DEFAULT, seeVideoPlayer.playbackParameters
properryExoPlayer.DRM_WIDEVINE
ExoPlayer.DRM_PLAYREADY
ExoPlayer.DRM_CLEARKEY
ExoPlayer.EXCEPTION_TYPE_RENDERER
:ExoPlaybackException.TYPE_RENDERER
ExoPlayer.EXCEPTION_TYPE_SOURCE
:ExoPlaybackException.TYPE_SOURCE
ExoPlayer.EXCEPTION_TYPE_UNEXPECTED
:ExoPlaybackException.TYPE_UNEXPECTED
ExoPlayer.CONTENT_TYPE_DASH
:C.CONTENT_TYPE_DASH
ExoPlayer.CONTENT_TYPE_HLS
:C.CONTENT_TYPE_HLS
ExoPlayer.CONTENT_TYPE_SS
:C.CONTENT_TYPE_SS
ExoPlayer.CONTENT_TYPE_OTHER
:C.CONTENT_TYPE_OTHER
ExoPlayer.TRACK_TYPE_UNKNOWN
:C.TRACK_TYPE_UNKNOWN
ExoPlayer.TRACK_TYPE_DEFAULT
:C.TRACK_TYPE_DEFAULT
ExoPlayer.TRACK_TYPE_AUDIO
:C.TRACK_TYPE_AUDIO
ExoPlayer.TRACK_TYPE_VIDEO
:C.TRACK_TYPE_VIDEO
ExoPlayer.TRACK_TYPE_TEXT
:C.TRACK_TYPE_TEXT
ExoPlayer.TRACK_TYPE_METADATA
:C.TRACK_TYPE_METADATA
ExoPlayer.TRACK_TYPE_CUSTOM_BASE
:C.TRACK_TYPE_CUSTOM_BASE
ExoPlayer.FORMAT_HANDLED
:RendererCapabilities.FORMAT_HANDLED
ExoPlayer.FORMAT_EXCEEDS_CAPABILITIES
:RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES
ExoPlayer.FORMAT_UNSUPPORTED_DRM
:RendererCapabilities.FORMAT_UNSUPPORTED_DRM
ExoPlayer.FORMAT_UNSUPPORTED_SUBTYPE
:RendererCapabilities.FORMAT_UNSUPPORTED_SUBTYPE
ExoPlayer.FORMAT_UNSUPPORTED_TYPE
:RendererCapabilities.FORMAT_UNSUPPORTED_TYPE
ExoPlayer.ADAPTIVE_SEAMLESS
:RendererCapabilities.ADAPTIVE_SEAMLESS
ExoPlayer.ADAPTIVE_NOT_SEAMLESS
:RendererCapabilities.ADAPTIVE_NOT_SEAMLESS
ExoPlayer.ADAPTIVE_NOT_SUPPORTED
:RendererCapabilities.ADAPTIVE_NOT_SUPPORTED
ExoPlayer.SURFACE_TYPE_NONE
ExoPlayer.SURFACE_TYPE_SURFACE_VIEW
ExoPlayer.SURFACE_TYPE_TEXTURE_VIEW
ExoPlayer.SURFACE_TYPE_SPHERICAL_VIEW
For full VideoPlayer API see documentation for original Ti.Media.VideoPlayer.
Documentation below describes only additional or removed methods, properties and events.
cancelAllThumbnailImageRequests
: not supportedrequestThumbnailImagesAtTimes
: not supportedthumbnailImageAtTime
: not supportedsetTrackSelectionOverride
: new methodMappingTrackSelector.setSelectionOverride
clearTrackSelectionOverrides
: new methodMappingTrackSelector.clearSelectionOverrides
setRendererDisabled
: new methodMappingTrackSelector.setRendererDisabled
setVolume
: new method. Sets the value of thevolume
property.getVolume
: new method. Gets the value of thevolume
property.setLinearGain
: new method. Sets the value of thelinearGain
property.getLinearGain
: new method. Gets the value of thelinearGain
property.
: removed (was deprecated, usedurationAvailable
durationavailable
): removed (was deprecated, useplaybackState
playbackstate
)error
: changed propertycode
value (one ofExoPlayer.EXCEPTION_TYPE_*
)metadata
: new event, propertymetadata
naturalsizeavailable
: new event, propertynaturalSize
(see VideoRendererEventListener.onVideoSizeChanged). Fired before a frame is rendered for the first time since setting the surface, and each time there's a change in the size, rotation or pixel aspect ratio of the video being rendered.trackschange
: new event, propertytrackInfo
volumechange
: new event, propertyvolume
. Fired when the volume onAudioManager.STREAM_MUSIC
changes.
adTagUri
contentExtension
: typestring
, when defined content type will be detected based on this propertycontentType
: one ofExoPlayer.CONTENT_TYPE_*
drmLicenseUrl
drmMultiSession
: typeboolean
, specify whether multiple key session support is enabled. Default valuefalse
drmScheme
: one ofExoPlayer.DRM_*
drmKeyRequestProperties
linearGain
: Ajusts player volume, with 0 being silence and 1 being unity gain. Default value: 1naturalSize
: Returns the natural size of the movie. Returns a dictionary with propertieswidth
,height
,rotation
andpixelRatio
(see Format). Returns0
for all properties if not known or applicable. Thenaturalsizeavailable
event is fired when the natural size is known.playbackParameters
: PlaybackParameters, Object with properties:pitch
: typenumber
, The factor by which the audio pitch will be scaled.skipSilence
: typeboolean
, Whether to skip silence in the input.speed
: typenumber
, The factor by which playback will be sped up.
showsControls
:videoPlayer.showsControls
surfaceType
: The type of surface view used for video playbacks. Valid values areExoPlayer.SURFACE_TYPE_*
.volume
: Ajusts volume ofAudioManager.STREAM_MUSIC
The following code creates a simple video player to play a local video file.
var ti_exoplayer = require("ru.netris.mobile.exoplayer");
var vidWin = Titanium.UI.createWindow({
title : 'Video View Demo',
backgroundColor : '#fff'
});
var videoPlayer = ti_exoplayer.createVideoPlayer({
top : 2,
autoplay : true,
backgroundColor : 'blue',
height : 300,
width : 300,
mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
videoPlayer.url = 'movie.mp4';
vidWin.add(videoPlayer);
vidWin.open();
Sergey Volkov [email protected]
Apache 2.0, see LICENSE