Skip to content

Most visited

Recently visited

navigation

TransportPerformer

public abstract class TransportPerformer
extends Object

java.lang.Object
   ↳ android.support.v4.media.TransportPerformer


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

Implemented by the playback side of the media system, to respond to requests to perform actions and to retrieve its current state. These requests may either come from key events dispatched directly to your UI, or events sent over a media button event receiver that this class keeps active while your window is in focus.

Summary

Public constructors

TransportPerformer()

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

Public methods

void onAudioFocusChange(int focusChange)

This method was deprecated in API level 25.3.0. You must implement your own audio focus handler.

int onGetBufferPercentage()

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

abstract long onGetCurrentPosition()

This method was deprecated in API level 25.3.0. Use setState(int, long, float).

abstract long onGetDuration()

This method was deprecated in API level 25.3.0. Use putLong(String, long) with METADATA_KEY_DURATION.

int onGetTransportControlFlags()

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

abstract boolean onIsPlaying()

This method was deprecated in API level 25.3.0. Use setState(int, long, float).

boolean onMediaButtonDown(int keyCode, KeyEvent event)

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

boolean onMediaButtonUp(int keyCode, KeyEvent event)

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

abstract void onPause()

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

abstract void onSeekTo(long pos)

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

abstract void onStart()

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

abstract void onStop()

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

Inherited methods

From class java.lang.Object

Public constructors

TransportPerformer

added in version 22.0.0
TransportPerformer ()

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

Public methods

onAudioFocusChange

added in version 22.0.0
void onAudioFocusChange (int focusChange)

This method was deprecated in API level 25.3.0.
You must implement your own audio focus handler.

Report that audio focus has changed on the app. This only happens if you have indicated you have started playing with TransportController.startPlaying, which takes audio focus for you.

Parameters
focusChange int: The type of focus change, as per OnAudioFocusChangeListener.onAudioFocusChange. The default implementation will deliver a KEYCODE_MEDIA_STOP when receiving AUDIOFOCUS_LOSS.

onGetBufferPercentage

added in version 22.0.0
int onGetBufferPercentage ()

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

Request to find out how much of the media has been buffered on the local device.

Returns
int Return a percentage (0-100) indicating how much of the total data has been buffered. The default implementation returns 100, meaning the content is always on the local device.

onGetCurrentPosition

added in version 22.0.0
long onGetCurrentPosition ()

This method was deprecated in API level 25.3.0.
Use setState(int, long, float).

Request to return the current playback position, in milliseconds.

Returns
long

onGetDuration

added in version 22.0.0
long onGetDuration ()

This method was deprecated in API level 25.3.0.
Use putLong(String, long) with METADATA_KEY_DURATION.

Request to return the duration of the current media, in milliseconds.

Returns
long

onGetTransportControlFlags

added in version 22.0.0
int onGetTransportControlFlags ()

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

Retrieves 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

The default implementation returns: FLAG_KEY_MEDIA_PLAY, FLAG_KEY_MEDIA_PLAY_PAUSE, FLAG_KEY_MEDIA_PAUSE, and FLAG_KEY_MEDIA_STOP

Returns
int

onIsPlaying

added in version 22.0.0
boolean onIsPlaying ()

This method was deprecated in API level 25.3.0.
Use setState(int, long, float).

Request to find out whether the player is currently playing its media.

Returns
boolean

onMediaButtonDown

added in version 22.0.0
boolean onMediaButtonDown (int keyCode, 
                KeyEvent event)

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

Report that a media button has been pressed. This is like onKeyDown(int, android.view.KeyEvent) but will only deliver media keys. The default implementation handles these keys:

Parameters
keyCode int: The code of the media key.
event KeyEvent: The full key event.
Returns
boolean Indicate whether the key has been consumed. The default implementation always returns true. This only matters for keys being dispatched here from TransportController.dispatchKeyEvent, and determines whether the key continues on to its default key handling (which for media keys means being delivered to the current media remote control, which should be us).

onMediaButtonUp

added in version 22.0.0
boolean onMediaButtonUp (int keyCode, 
                KeyEvent event)

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

Report that a media button has been released. This is like onKeyUp(int, android.view.KeyEvent) but will only deliver media keys. The default implementation does nothing.

Parameters
keyCode int: The code of the media key.
event KeyEvent: The full key event.
Returns
boolean Indicate whether the key has been consumed. The default implementation always returns true. This only matters for keys being dispatched here from TransportController.dispatchKeyEvent, and determines whether the key continues on to its default key handling (which for media keys means being delivered to the current media remote control, which should be us).

onPause

added in version 22.0.0
void onPause ()

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

Request to pause playback of the media, staying at the current playback position and other state so a later call to onStart() will resume at the same place.

onSeekTo

added in version 22.0.0
void onSeekTo (long pos)

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

Request to move the current playback position.

Parameters
pos long: New position to move to, in milliseconds.

onStart

added in version 22.0.0
void onStart ()

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

Request to start playback on the media, resuming from whatever current state (position etc) it is in.

onStop

added in version 22.0.0
void onStop ()

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

Request to completely stop playback of the media, clearing whatever state the player thinks is appropriate.

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.