belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1
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
Constants | |
---|---|
String |
EXTRA_LEGACY_STREAM_TYPE
Used as an integer extra field in |
Public methods | |
---|---|
abstract
void
|
fastForward()
Starts 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 |
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 |
abstract
void
|
prepare()
Request that the player prepare for playback. |
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 |
abstract
void
|
rewind()
Starts rewinding. |
abstract
void
|
seekTo(long pos)
Moves to a new location in the media stream. |
abstract
void
|
sendCustomAction(String action, Bundle args)
Sends the id and args from a custom action for the
|
abstract
void
|
sendCustomAction(PlaybackStateCompat.CustomAction customAction, Bundle args)
Sends a custom action for the |
abstract
void
|
setCaptioningEnabled(boolean enabled)
Enables/disables captioning for this session. |
abstract
void
|
setRating(RatingCompat rating, Bundle extras)
Rates a media item. |
abstract
void
|
setRating(RatingCompat rating)
Rates the current content. |
abstract
void
|
setRepeatMode(int repeatMode)
Sets the repeat mode for this session. |
abstract
void
|
setShuffleMode(int shuffleMode)
Sets the shuffle mode for this session. |
abstract
void
|
skipToNext()
Skips to the next item. |
abstract
void
|
skipToPrevious()
Skips to the previous item. |
abstract
void
|
skipToQueueItem(long id)
Plays 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
|
Constants
EXTRA_LEGACY_STREAM_TYPE
String EXTRA_LEGACY_STREAM_TYPE
Used as an integer extra field in playFromMediaId(String, Bundle)
or
prepareFromMediaId(String, Bundle)
to indicate the stream type to be used by the
media player when playing or preparing the specified media id. See AudioManager
for a list of stream types.
Constant Value: "android.media.session.extra.LEGACY_STREAM_TYPE"
Public methods
fastForward
void fastForward ()
Starts 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 for playback. This can decrease the time it takes to
start playback when a play command is received. Preparation is not required. You can
call play()
without calling this method beforehand.
prepareFromMediaId
void prepareFromMediaId (String mediaId, Bundle extras)
Request that the player prepare playback for a specific media id. This can decrease the
time it takes to start playback when a play command is received. Preparation is not
required. You can call playFromMediaId(String, Bundle)
without calling this method beforehand.
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. This can decrease
the time it takes to start playback when a play command is received. An empty or null
query should be treated as a request to prepare any music. Preparation is not required.
You can call playFromSearch(String, Bundle)
without calling this method beforehand.
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
. This can decrease
the time it takes to start playback when a play command is received. Preparation is not
required. You can call playFromUri(Uri, Bundle)
without calling this method beforehand.
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 ()
Starts rewinding. If playback is already rewinding this may increase the rate.
seekTo
void seekTo (long pos)
Moves to a new location in the media stream.
Parameters | |
---|---|
pos |
long : Position to move to, in milliseconds.
|
sendCustomAction
void sendCustomAction (String action, Bundle args)
Sends 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.
|
sendCustomAction
void sendCustomAction (PlaybackStateCompat.CustomAction customAction, Bundle args)
Sends 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.
|
setCaptioningEnabled
void setCaptioningEnabled (boolean enabled)
Enables/disables captioning for this session.
Parameters | |
---|---|
enabled |
boolean : true to enable captioning, false to disable.
|
setRating
void setRating (RatingCompat rating, Bundle extras)
Rates a media item. This will cause the rating to be set for
the specific media item. The rating type of the given RatingCompat
must match
the type returned by getRatingType()
.
Parameters | |
---|---|
rating |
RatingCompat : The rating to set for the media item. |
extras |
Bundle : Optional arguments that can include information about the media item
to be rated. |
setRating
void setRating (RatingCompat rating)
Rates the current content. This will cause the rating to be set for
the current user. The rating type of the given RatingCompat
must match the type
returned by getRatingType()
.
Parameters | |
---|---|
rating |
RatingCompat : The rating to set for the current content
|
setRepeatMode
void setRepeatMode (int repeatMode)
Sets the repeat mode for this session.
Parameters | |
---|---|
repeatMode |
int : The repeat mode. Must be one of the followings:
REPEAT_MODE_NONE ,
REPEAT_MODE_ONE ,
REPEAT_MODE_ALL ,
REPEAT_MODE_GROUP
|
setShuffleMode
void setShuffleMode (int shuffleMode)
Sets the shuffle mode for this session.
Parameters | |
---|---|
shuffleMode |
int : The shuffle mode. Must be one of the followings:
SHUFFLE_MODE_NONE ,
SHUFFLE_MODE_ALL ,
SHUFFLE_MODE_GROUP
|
skipToQueueItem
void skipToQueueItem (long id)
Plays 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.
Interfaces
Classes
- MediaButtonReceiver
- MediaControllerCompat
- MediaControllerCompat.Callback
- MediaControllerCompat.PlaybackInfo
- MediaControllerCompat.TransportControls
- MediaSessionCompat
- MediaSessionCompat.Callback
- MediaSessionCompat.QueueItem
- MediaSessionCompat.Token
- ParcelableVolumeInfo
- PlaybackStateCompat
- PlaybackStateCompat.Builder
- PlaybackStateCompat.CustomAction
- PlaybackStateCompat.CustomAction.Builder