Android APIs
public static abstract class

MediaControllerCompat.TransportControls

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

Class Overview

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 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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public abstract void fastForward ()

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

public abstract void pause ()

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

public abstract void play ()

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

public abstract void playFromMediaId (String mediaId, Bundle extras)

Request that the player start playback for a specific Uri.

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

public abstract 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 The search query.
extras Optional extras that can include extra information about the query.

public abstract void playFromUri (Uri uri, Bundle extras)

Request that the player start playback for a specific Uri.

This method is not supported on API 21-22.

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

public abstract void rewind ()

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

public abstract void seekTo (long pos)

Move to a new location in the media stream.

Parameters
pos Position to move to, in milliseconds.

public abstract void sendCustomAction (String action, Bundle args)

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

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

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

Send a custom action for the MediaSessionCompat to perform.

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

public abstract 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 The rating to set for the current content

public abstract void skipToNext ()

Skip to the next item.

public abstract void skipToPrevious ()

Skip to the previous item.

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

public abstract void stop ()

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