public final class MediaController.TransportControls extends Object
Modifier and Type | Method and Description |
---|---|
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
Uri . |
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
Uri . |
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
MediaSession to perform. |
void |
sendCustomAction(String action,
Bundle args)
Send the id and args from a custom action back for the
MediaSession to perform. |
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.
|
public void prepare()
PlaybackState.STATE_PAUSED
. Afterwards, play()
can be called to
start playback.public void prepareFromMediaId(String mediaId, Bundle extras)
PlaybackState.STATE_PAUSED
. Afterwards,
play()
can be called to start playback. If the preparation is not needed,
playFromMediaId(java.lang.String, android.os.Bundle)
can be directly called without this method.mediaId
- The id of the requested media.extras
- Optional extras that can include extra information about the media item
to be prepared.public void prepareFromSearch(String query, Bundle extras)
PlaybackState.STATE_PAUSED
. Afterwards,
play()
can be called to start playback. If the preparation is not needed,
playFromSearch(java.lang.String, android.os.Bundle)
can be directly called without this method.query
- The search query.extras
- Optional extras that can include extra information
about the query.public void prepareFromUri(Uri uri, Bundle extras)
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 PlaybackState.STATE_PAUSED
. Afterwards,
play()
can be called to start playback. If the preparation is not needed,
playFromUri(android.net.Uri, android.os.Bundle)
can be directly called without this method.uri
- The URI of the requested media.extras
- Optional extras that can include extra information about the media item
to be prepared.public void play()
public void playFromMediaId(String mediaId, Bundle extras)
mediaId
- The id of the requested media.extras
- Optional extras that can include extra information about the media item
to be played.public void playFromSearch(String query, Bundle extras)
query
- The search query.extras
- Optional extras that can include extra information
about the query.public void playFromUri(Uri uri, Bundle extras)
Uri
.uri
- The URI of the requested media.extras
- Optional extras that can include extra information about the media item
to be played.public void skipToQueueItem(long id)
public void pause()
public void stop()
public void seekTo(long pos)
pos
- Position to move to, in milliseconds.public void fastForward()
public void skipToNext()
public void rewind()
public void skipToPrevious()
public void setRating(Rating rating)
MediaController.getRatingType()
.rating
- The rating to set for the current contentpublic void sendCustomAction(PlaybackState.CustomAction customAction, Bundle args)
MediaSession
to perform.customAction
- The action to perform.args
- Optional arguments to supply to the MediaSession
for this
custom action.public void sendCustomAction(String action, Bundle args)
MediaSession
to perform.action
- The action identifier of the PlaybackState.CustomAction
as
specified by the MediaSession
.args
- Optional arguments to supply to the MediaSession
for this
custom action.sendCustomAction(PlaybackState.CustomAction action, Bundle args)