Skip to content

Latest commit

 

History

History
132 lines (109 loc) · 9.59 KB

index.md

File metadata and controls

132 lines (109 loc) · 9.59 KB

ti.exoplayer Module

Description

A native control for playing videos for Titanium. Based on Google ExoPlayer, using Titanium.Media.VideoPlayer API.

Accessing the ti.exoplayer Module

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.

Methods

Properties

VideoPlayer

For full VideoPlayer API see documentation for original Ti.Media.VideoPlayer.

Documentation below describes only additional or removed methods, properties and events.

Methods

  • cancelAllThumbnailImageRequests: not supported
  • requestThumbnailImagesAtTimes: not supported
  • thumbnailImageAtTime: not supported
  • setTrackSelectionOverride: new method MappingTrackSelector.setSelectionOverride
  • clearTrackSelectionOverrides: new method MappingTrackSelector.clearSelectionOverrides
  • setRendererDisabled: new method MappingTrackSelector.setRendererDisabled
  • setVolume: new method. Sets the value of the volume property.
  • getVolume: new method. Gets the value of the volume property.
  • setLinearGain: new method. Sets the value of the linearGain property.
  • getLinearGain: new method. Gets the value of the linearGain property.

Events

  • durationAvailable: removed (was deprecated, use durationavailable)
  • playbackState: removed (was deprecated, use playbackstate)
  • error: changed property code value (one of ExoPlayer.EXCEPTION_TYPE_*)
  • metadata: new event, property metadata
  • naturalsizeavailable: new event, property naturalSize (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, property trackInfo
  • volumechange: new event, property volume. Fired when the volume on AudioManager.STREAM_MUSIC changes.

Properties

  • adTagUri
  • contentExtension: type string, when defined content type will be detected based on this property
  • contentType: one of ExoPlayer.CONTENT_TYPE_*
  • drmLicenseUrl
  • drmMultiSession: type boolean, specify whether multiple key session support is enabled. Default value false
  • drmScheme: one of ExoPlayer.DRM_*
  • drmKeyRequestProperties
  • linearGain: Ajusts player volume, with 0 being silence and 1 being unity gain. Default value: 1
  • naturalSize: Returns the natural size of the movie. Returns a dictionary with properties width, height, rotation and pixelRatio (see Format). Returns 0 for all properties if not known or applicable. The naturalsizeavailable event is fired when the natural size is known.
  • playbackParameters: PlaybackParameters, Object with properties:
    • pitch: type number, The factor by which the audio pitch will be scaled.
    • skipSilence: type boolean, Whether to skip silence in the input.
    • speed: type number, The factor by which playback will be sped up.
  • showsControls: videoPlayer.showsControls
  • surfaceType: The type of surface view used for video playbacks. Valid values are ExoPlayer.SURFACE_TYPE_*.
  • volume: Ajusts volume of AudioManager.STREAM_MUSIC

Usage

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

Author

Sergey Volkov [email protected]

License

Apache 2.0, see LICENSE