Skip to content

Most visited

Recently visited

navigation

TransportController

public abstract class TransportController
extends Object

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


This class was deprecated in API level 25.3.0.
Use MediaControllerCompat.

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

This constructor was deprecated in API level 25.3.0. Use MediaControllerCompat.

Public methods

abstract int getBufferPercentage()

This method was deprecated in API level 25.3.0. Use getBufferedPosition() and METADATA_KEY_DURATION.

abstract long getCurrentPosition()

This method was deprecated in API level 25.3.0. Use getPosition() and getLastPositionUpdateTime().

abstract long getDuration()

This method was deprecated in API level 25.3.0. Use METADATA_KEY_DURATION.

abstract int getTransportControlFlags()

This method was deprecated in API level 25.3.0. Use getActions().

abstract boolean isPlaying()

This method was deprecated in API level 25.3.0. Use getState().

abstract void pausePlaying()

This method was deprecated in API level 25.3.0. Use pause().

abstract void registerStateListener(TransportStateListener listener)

This method was deprecated in API level 25.3.0. Use registerCallback(MediaControllerCompat.Callback).

abstract void seekTo(long pos)

This method was deprecated in API level 25.3.0. Use seekTo(long).

abstract void startPlaying()

This method was deprecated in API level 25.3.0. Use play().

abstract void stopPlaying()

This method was deprecated in API level 25.3.0. Use stop().

abstract void unregisterStateListener(TransportStateListener listener)

This method was deprecated in API level 25.3.0. Use unregisterCallback(MediaControllerCompat.Callback).

Inherited methods

From class java.lang.Object

Public constructors

TransportController

added in version 22.0.0
TransportController ()

This constructor was deprecated in API level 25.3.0.
Use MediaControllerCompat.

Public methods

getBufferPercentage

added in version 22.0.0
int getBufferPercentage ()

This method was deprecated in API level 25.3.0.
Use getBufferedPosition() and METADATA_KEY_DURATION.

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

added in version 22.0.0
long getCurrentPosition ()

This method was deprecated in API level 25.3.0.
Use getPosition() and getLastPositionUpdateTime().

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

Returns
long

getDuration

added in version 22.0.0
long getDuration ()

This method was deprecated in API level 25.3.0.
Use METADATA_KEY_DURATION.

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

Returns
long

getTransportControlFlags

added in version 22.0.0
int getTransportControlFlags ()

This method was deprecated in API level 25.3.0.
Use getActions().

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

added in version 22.0.0
boolean isPlaying ()

This method was deprecated in API level 25.3.0.
Use getState().

Return whether the player is currently playing its stream.

Returns
boolean

pausePlaying

added in version 22.0.0
void pausePlaying ()

This method was deprecated in API level 25.3.0.
Use pause().

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

registerStateListener

added in version 22.0.0
void registerStateListener (TransportStateListener listener)

This method was deprecated in API level 25.3.0.
Use registerCallback(MediaControllerCompat.Callback).

Start listening to changes in playback state.

Parameters
listener TransportStateListener

seekTo

added in version 22.0.0
void seekTo (long pos)

This method was deprecated in API level 25.3.0.
Use seekTo(long).

Move to a new location in the media stream.

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

startPlaying

added in version 22.0.0
void startPlaying ()

This method was deprecated in API level 25.3.0.
Use play().

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

stopPlaying

added in version 22.0.0
void stopPlaying ()

This method was deprecated in API level 25.3.0.
Use stop().

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

unregisterStateListener

added in version 22.0.0
void unregisterStateListener (TransportStateListener listener)

This method was deprecated in API level 25.3.0.
Use unregisterCallback(MediaControllerCompat.Callback).

Stop listening to changes in playback state.

Parameters
listener TransportStateListener
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.