TransportControls
abstract class TransportControls
kotlin.Any | |
↳ | 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 |
|
---|---|
static String |
Used as an integer extra field in |
Public methods |
|
---|---|
abstract Unit |
Starts fast forwarding. |
abstract Unit |
pause() Request that the player pause its playback and stay at its current position. |
abstract Unit |
play() Request that the player start its playback at its current position. |
abstract Unit |
playFromMediaId(mediaId: String!, extras: Bundle!) Request that the player start playback for a specific |
abstract Unit |
playFromSearch(query: String!, extras: Bundle!) Request that the player start playback for a specific search query. |
abstract Unit |
playFromUri(uri: Uri!, extras: Bundle!) Request that the player start playback for a specific |
abstract Unit |
prepare() Request that the player prepare for playback. |
abstract Unit |
prepareFromMediaId(mediaId: String!, extras: Bundle!) Request that the player prepare playback for a specific media id. |
abstract Unit |
prepareFromSearch(query: String!, extras: Bundle!) Request that the player prepare playback for a specific search query. |
abstract Unit |
prepareFromUri(uri: Uri!, extras: Bundle!) Request that the player prepare playback for a specific |
abstract Unit |
rewind() Starts rewinding. |
abstract Unit |
Moves to a new location in the media stream. |
abstract Unit |
sendCustomAction(customAction: PlaybackStateCompat.CustomAction!, args: Bundle!) Sends a custom action for the |
abstract Unit |
sendCustomAction(action: String!, args: Bundle!) Sends the id and args from a custom action for the |
abstract Unit |
setCaptioningEnabled(enabled: Boolean) Enables/disables captioning for this session. |
abstract Unit |
setRating(rating: RatingCompat!) Rates the current content. |
abstract Unit |
setRating(rating: RatingCompat!, extras: Bundle!) Rates a media item. |
abstract Unit |
setRepeatMode(repeatMode: Int) Sets the repeat mode for this session. |
abstract Unit |
setShuffleMode(shuffleMode: Int) Sets the shuffle mode for this session. |
abstract Unit |
Skips to the next item. |
abstract Unit |
Skips to the previous item. |
abstract Unit |
skipToQueueItem(id: Long) Plays an item with a specific id in the play queue. |
abstract Unit |
stop() Request that the player stop its playback; it may clear its state in whatever way is appropriate. |
Constants
EXTRA_LEGACY_STREAM_TYPE
static val EXTRA_LEGACY_STREAM_TYPE: String
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.
Value: "android.media.session.extra.LEGACY_STREAM_TYPE"
Public methods
fastForward
abstract fun fastForward(): Unit
Starts fast forwarding. If playback is already fast forwarding this may increase the rate.
pause
abstract fun pause(): Unit
Request that the player pause its playback and stay at its current position.
playFromMediaId
abstract fun playFromMediaId(mediaId: String!, extras: Bundle!): Unit
Request that the player start playback for a specific Uri
.
Parameters | |
---|---|
mediaId |
String!: The uri of the requested media. |
extras |
String!: Optional extras that can include extra information about the media item to be played. |
playFromSearch
abstract fun playFromSearch(query: String!, extras: Bundle!): Unit
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 |
String!: Optional extras that can include extra information about the query. |
playFromUri
abstract fun playFromUri(uri: Uri!, extras: Bundle!): Unit
Request that the player start playback for a specific Uri
.
Parameters | |
---|---|
uri |
Uri!: The URI of the requested media. |
extras |
Uri!: Optional extras that can include extra information about the media item to be played. |
prepare
abstract fun prepare(): Unit
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
abstract fun prepareFromMediaId(mediaId: String!, extras: Bundle!): Unit
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
without calling this method beforehand.
Parameters | |
---|---|
mediaId |
String!: The id of the requested media. |
extras |
String!: Optional extras that can include extra information about the media item to be prepared. |
prepareFromSearch
abstract fun prepareFromSearch(query: String!, extras: Bundle!): Unit
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
without calling this method beforehand.
Parameters | |
---|---|
query |
String!: The search query. |
extras |
String!: Optional extras that can include extra information about the query. |
prepareFromUri
abstract fun prepareFromUri(uri: Uri!, extras: Bundle!): Unit
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
without calling this method beforehand.
Parameters | |
---|---|
uri |
Uri!: The URI of the requested media. |
extras |
Uri!: Optional extras that can include extra information about the media item to be prepared. |
rewind
abstract fun rewind(): Unit
Starts rewinding. If playback is already rewinding this may increase the rate.