Most visited

Recently visited

TransportController

public abstract class TransportController
extends Object

java.lang.Object
   ↳ android.support.v4.media.TransportController
Known Direct Subclasses


Base interface to controlling a media transport. This is the interface for implementing things like on-screen controls: it allows them to request changes in playback, retrieve the current playback state, and monitor for changes to the playback state.

Summary

Public constructors

TransportController()

Public methods

abstract int getBufferPercentage()

Retrieve amount, in percentage (0-100), that the media stream has been buffered on to the local device.

abstract long getCurrentPosition()

Retrieve the current playback location in the media stream, in milliseconds.

abstract long getDuration()

Retrieve the total duration of the media stream, in milliseconds.

abstract int getTransportControlFlags()

Retrieve the flags for the media transport control buttons that this transport supports.

abstract boolean isPlaying()

Return whether the player is currently playing its stream.

abstract void pausePlaying()

Request that the player pause its playback and stay at its current position.

abstract void registerStateListener(TransportStateListener listener)

Start listening to changes in playback state.

abstract void seekTo(long pos)

Move to a new location in the media stream.

abstract void startPlaying()

Request that the player start its playback at its current position.

abstract void stopPlaying()

Request that the player stop its playback; it may clear its state in whatever way is appropriate.

abstract void unregisterStateListener(TransportStateListener listener)

Stop listening to changes in playback state.

Inherited methods

From class java.lang.Object

Public constructors

TransportController

TransportController ()

Public methods

getBufferPercentage

int getBufferPercentage ()

Retrieve amount, in percentage (0-100), that the media stream has been buffered on to the local device. Return 100 if the stream is always local.

Returns
int

getCurrentPosition

long getCurrentPosition ()

Retrieve the current playback location in the media stream, in milliseconds.

Returns
long

getDuration

long getDuration ()

Retrieve the total duration of the media stream, in milliseconds.

Returns
long

getTransportControlFlags

int getTransportControlFlags ()

Retrieve the flags for the media transport control buttons that this transport supports. Result is a combination of the following flags: FLAG_KEY_MEDIA_PREVIOUS, FLAG_KEY_MEDIA_REWIND, FLAG_KEY_MEDIA_PLAY, FLAG_KEY_MEDIA_PLAY_PAUSE, FLAG_KEY_MEDIA_PAUSE, FLAG_KEY_MEDIA_STOP, FLAG_KEY_MEDIA_FAST_FORWARD, FLAG_KEY_MEDIA_NEXT

Returns
int

isPlaying

boolean isPlaying ()

Return whether the player is currently playing its stream.

Returns
boolean

pausePlaying

void pausePlaying ()

Request that the player pause its playback and stay at its current position.

registerStateListener

void registerStateListener (TransportStateListener listener)

Start listening to changes in playback state.

Parameters
listener TransportStateListener

seekTo

void seekTo (long pos)

Move to a new location in the media stream.

Parameters
pos long: Position to move to, in milliseconds.

startPlaying

void startPlaying ()

Request that the player start its playback at its current position.

stopPlaying

void stopPlaying ()

Request that the player stop its playback; it may clear its state in whatever way is appropriate.

unregisterStateListener

void unregisterStateListener (TransportStateListener listener)

Stop listening to changes in playback state.

Parameters
listener TransportStateListener

Hooray!