android.support.v4.media
Class TransportController

java.lang.Object
  extended by android.support.v4.media.TransportController
Direct Known Subclasses:
TransportMediator

public abstract class TransportController
extends java.lang.Object

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.


Constructor Summary
TransportController()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportController

public TransportController()
Method Detail

registerStateListener

public abstract void registerStateListener(TransportStateListener listener)
Start listening to changes in playback state.


unregisterStateListener

public abstract void unregisterStateListener(TransportStateListener listener)
Stop listening to changes in playback state.


startPlaying

public abstract void startPlaying()
Request that the player start its playback at its current position.


pausePlaying

public abstract void pausePlaying()
Request that the player pause its playback and stay at its current position.


stopPlaying

public abstract void stopPlaying()
Request that the player stop its playback; it may clear its state in whatever way is appropriate.


getDuration

public abstract long getDuration()
Retrieve the total duration of the media stream, in milliseconds.


getCurrentPosition

public abstract long getCurrentPosition()
Retrieve the current playback location in the media stream, in milliseconds.


seekTo

public abstract void seekTo(long pos)
Move to a new location in the media stream.

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

isPlaying

public abstract boolean isPlaying()
Return whether the player is currently playing its stream.


getBufferPercentage

public abstract 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.


getTransportControlFlags

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