Most visited

Recently visited

MediaControllerCompat.TransportControls

public static abstract class MediaControllerCompat.TransportControls
extends Object

java.lang.Object
   ↳ android.support.v4.media.session.MediaControllerCompat.TransportControls


Interface for controlling media playback on a session. This allows an app to send media transport commands to the session.

Summary

Public methods

abstract void fastForward()

Start fast forwarding.

abstract void pause()

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

abstract void play()

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

abstract void playFromMediaId(String mediaId, Bundle extras)

Request that the player start playback for a specific Uri.

abstract void playFromSearch(String query, Bundle extras)

Request that the player start playback for a specific search query.

abstract void playFromUri(Uri uri, Bundle extras)

Request that the player start playback for a specific Uri.

abstract void prepare()

Request that the player prepare its playback without audio focus.

abstract void prepareFromMediaId(String mediaId, Bundle extras)

Request that the player prepare playback for a specific media id.

abstract void prepareFromSearch(String query, Bundle extras)

Request that the player prepare playback for a specific search query.

abstract void prepareFromUri(Uri uri, Bundle extras)

Request that the player prepare playback for a specific Uri.

abstract void rewind()

Start rewinding.

abstract void seekTo(long pos)

Move to a new location in the media stream.

abstract void sendCustomAction(String action, Bundle args)

Send the id and args from a custom action for the MediaSessionCompat to perform.

abstract void sendCustomAction(PlaybackStateCompat.CustomAction customAction, Bundle args)

Send a custom action for the MediaSessionCompat to perform.

abstract void setRating(RatingCompat rating)

Rate the current content.

abstract void skipToNext()

Skip to the next item.

abstract void skipToPrevious()

Skip to the previous item.

abstract void skipToQueueItem(long id)

Play an item with a specific id in the play queue.

abstract void stop()

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

Inherited methods

From class java.lang.Object

Public methods

fastForward

void fastForward ()

Start fast forwarding. If playback is already fast forwarding this may increase the rate.

pause

void pause ()

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

play

void play ()

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

playFromMediaId

void playFromMediaId (String mediaId, 
                Bundle extras)

Request that the player start playback for a specific Uri.

Parameters
mediaId String: The uri of the requested media.
extras Bundle: Optional extras that can include extra information about the media item to be played.

playFromSearch

void playFromSearch (String query, 
                Bundle extras)

Request that the player start playback for a specific search query. An empty or null query should be treated as a request to play any music.

Parameters
query String: The search query.
extras Bundle: Optional extras that can include extra information about the query.

playFromUri

void playFromUri (Uri uri, 
                Bundle extras)

Request that the player start playback for a specific Uri.

Parameters
uri Uri: The URI of the requested media.
extras Bundle: Optional extras that can include extra information about the media item to be played.

prepare

void prepare ()

Request that the player prepare its playback without audio focus. In other words, other session can continue to play during the preparation of this session. This method can be used to speed up the start of the playback. Once the preparation is done, the session will change its playback state to STATE_PAUSED. Afterwards, play() can be called to start playback. If the preparation is not needed, play() can be directly called without this method.

prepareFromMediaId

void prepareFromMediaId (String mediaId, 
                Bundle extras)

Request that the player prepare playback for a specific media id. In other words, other session can continue to play during the preparation of this session. This method can be used to speed up the start of the playback. Once the preparation is done, the session will change its playback state to STATE_PAUSED. Afterwards, play() can be called to start playback. If the preparation is not needed, playFromMediaId(String, Bundle) can be directly called without this method.

Parameters
mediaId String: The id of the requested media.
extras Bundle: Optional extras that can include extra information about the media item to be prepared.

prepareFromSearch

void prepareFromSearch (String query, 
                Bundle extras)

Request that the player prepare playback for a specific search query. An empty or null query should be treated as a request to prepare any music. In other words, other session can continue to play during the preparation of this session. This method can be used to speed up the start of the playback. Once the preparation is done, the session will change its playback state to STATE_PAUSED. Afterwards, play() can be called to start playback. If the preparation is not needed, playFromSearch(String, Bundle) can be directly called without this method.

Parameters
query String: The search query.
extras Bundle: Optional extras that can include extra information about the query.

prepareFromUri

void prepareFromUri (Uri uri, 
                Bundle extras)

Request that the player prepare playback for a specific Uri. In other words, other session can continue to play during the preparation of this session. This method can be used to speed up the start of the playback. Once the preparation is done, the session will change its playback state to STATE_PAUSED. Afterwards, play() can be called to start playback. If the preparation is not needed, playFromUri(Uri, Bundle) can be directly called without this method.

Parameters
uri Uri: The URI of the requested media.
extras Bundle: Optional extras that can include extra information about the media item to be prepared.

rewind

void rewind ()

Start rewinding. If playback is already rewinding this may increase the rate.

seekTo

void seekTo (long pos)

Move to a new location in the media stream.

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

sendCustomAction

void sendCustomAction (String action, 
                Bundle args)

Send the id and args from a custom action for the MediaSessionCompat to perform.

Parameters
action String: The action identifier of the PlaybackStateCompat.CustomAction as specified by the MediaSessionCompat.
args Bundle: Optional arguments to supply to the MediaSessionCompat for this custom action.

See also:

sendCustomAction

void sendCustomAction (PlaybackStateCompat.CustomAction customAction, 
                Bundle args)

Send a custom action for the MediaSessionCompat to perform.

Parameters
customAction PlaybackStateCompat.CustomAction: The action to perform.
args Bundle: Optional arguments to supply to the MediaSessionCompat for this custom action.

setRating

void setRating (RatingCompat rating)

Rate the current content. This will cause the rating to be set for the current user. The Rating type must match the type returned by getRatingType().

Parameters
rating RatingCompat: The rating to set for the current content

skipToNext

void skipToNext ()

Skip to the next item.

skipToPrevious

void skipToPrevious ()

Skip to the previous item.

skipToQueueItem

void skipToQueueItem (long id)

Play an item with a specific id in the play queue. If you specify an id that is not in the play queue, the behavior is undefined.

Parameters
id long

stop

void stop ()

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

Hooray!