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
import exoPlayer from 'ti.exoplayer';
const exoView = exoPlayer.createExoPlayer();
- 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
- 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)
- playerState: state (on of the constants)
- metaData: title, album, albumTitle, albumArtist
- seek: position, oldPosition
- STATE_IDLE
- STATE_BUFFERING
- STATE_READY
- STATE_ENDED
- STATE_PLAYING
Check the example/app.js
for code.
- Michael Gangolf (@MichaelGangolf / Web)