Best android open-source packages and libraries.

Ti.exoplayer

Ti.Exoplayer - Audio/Video player for Android
Updated 9 months ago

ExoPlayer module for Titanium SDK

Using Androids Media3 ExoPlayer to play audio and video streams.

ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks

Based on Media3 ExoPlayer 1.1.0. Suppored media formats

Code

import exoPlayer from 'ti.exoplayer';
const exoView = exoPlayer.createExoPlayer();

Methods

  • play(): plays the audio/video file
  • pause(): pauses the stream
  • stop(): stops the stream
  • release(): releases the player. Run this when you don't need it anymore
  • seekTo(ms): seek to a position in the file

Properties

  • audioOnly (boolean, creation only): player won't create a "video surface" and safes resources.
  • url (String): the URL of the audio/video file
  • playing (boolean): current play status
  • currentPosition (int): current position
  • duration (int): duration (-1 if unavailable)
  • minBufferDuration (int): min buffer duration in ms (default: 3000)
  • maxBufferDuration (int): max buffer duration in ms (default: 8000)
  • minResumeBuffer (int): min playback resume buffer duration in ms (default: 1500)
  • minStartBuffer (int): min playback start buffer duration in ms (default: 500)
  • targetBufferBytes (int): target buffer size in bytes. Only used if >-1 and other the other buffer durations will be ignored (default: -1)
  • crossProtocolRedirects (boolean): Allow cross platform redirects (default: false)

Events

  • playerState: state (on of the constants)
  • metaData: title, album, albumTitle, albumArtist
  • seek: position, oldPosition

Constants

  • STATE_IDLE
  • STATE_BUFFERING
  • STATE_READY
  • STATE_ENDED
  • STATE_PLAYING

Example

Check the example/app.js for code.

Author

Buy Me A Coke donate button