public
final
class
MediaController.TransportControls
extends Object
java.lang.Object | |
↳ | android.media.session.MediaController.TransportControls |
Interface for controlling media playback on a session. This allows an app to send media transport commands to the session.
Public methods | |
---|---|
void
|
fastForward()
Start fast forwarding. |
void
|
pause()
Request that the player pause its playback and stay at its current position. |
void
|
play()
Request that the player start its playback at its current position. |
void
|
playFromMediaId(String mediaId, Bundle extras)
Request that the player start playback for a specific media id. |
void
|
playFromSearch(String query, Bundle extras)
Request that the player start playback for a specific search query. |
void
|
playFromUri(Uri uri, Bundle extras)
Request that the player start playback for a specific |
void
|
prepare()
Request that the player prepare its playback. |
void
|
prepareFromMediaId(String mediaId, Bundle extras)
Request that the player prepare playback for a specific media id. |
void
|
prepareFromSearch(String query, Bundle extras)
Request that the player prepare playback for a specific search query. |
void
|
prepareFromUri(Uri uri, Bundle extras)
Request that the player prepare playback for a specific |
void
|
rewind()
Start rewinding. |
void
|
seekTo(long pos)
Move to a new location in the media stream. |
void
|
sendCustomAction(PlaybackState.CustomAction customAction, Bundle args)
Send a custom action back for the |
void
|
sendCustomAction(String action, Bundle args)
Send the id and args from a custom action back for the |
void
|
setRating(Rating rating)
Rate the current content. |
void
|
skipToNext()
Skip to the next item. |
void
|
skipToPrevious()
Skip to the previous item. |
void
|
skipToQueueItem(long id)
Play an item with a specific id in the play queue. |
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
|
void fastForward ()
Start fast forwarding. If playback is already fast forwarding this may increase the rate.
void pause ()
Request that the player pause its playback and stay at its current position.
void play ()
Request that the player start its playback at its current position.
void playFromMediaId (String mediaId, Bundle extras)
Request that the player start playback for a specific media id.
Parameters | |
---|---|
mediaId |
String :
The id of the requested media. |
extras |
Bundle :
Optional extras that can include extra information about the media item
to be played.
|
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.
|
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.
|
void prepare ()
Request that the player prepare its playback. In other words, other sessions 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.
void prepareFromMediaId (String mediaId, Bundle extras)
Request that the player prepare playback for a specific media id. In other words, other
sessions 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.
|
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 sessions
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.
|
void prepareFromUri (Uri uri, Bundle extras)
Request that the player prepare playback for a specific Uri
. In other words,
other sessions 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.
|
void rewind ()
Start rewinding. If playback is already rewinding this may increase the rate.
void seekTo (long pos)
Move to a new location in the media stream.
Parameters | |
---|---|
pos |
long :
Position to move to, in milliseconds.
|
void sendCustomAction (PlaybackState.CustomAction customAction, Bundle args)
Send a custom action back for the MediaSession
to perform.
Parameters | |
---|---|
customAction |
PlaybackState.CustomAction :
The action to perform. |
args |
Bundle :
Optional arguments to supply to the MediaSession for this
custom action.
|
void sendCustomAction (String action, Bundle args)
Send the id and args from a custom action back for the MediaSession
to perform.
Parameters | |
---|---|
action |
String :
The action identifier of the PlaybackState.CustomAction as
specified by the MediaSession . |
args |
Bundle :
Optional arguments to supply to the MediaSession for this
custom action.
|
void setRating (Rating 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 |
Rating :
The rating to set for the current content
|
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
|
void stop ()
Request that the player stop its playback; it may clear its state in whatever way is appropriate.