java.lang.Object | |
↳ | android.media.session.PlaybackState.Builder |
Builder for PlaybackState
objects.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an initially empty state builder.
| |||||||||||
Creates a builder with the same initial values as those in the from
state.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a custom action to the playback state.
| |||||||||||
Add a custom action to the playback state.
| |||||||||||
Build and return the
PlaybackState instance with these
values.
| |||||||||||
Set the current actions available on this session.
| |||||||||||
Set the active item in the play queue by specifying its id.
| |||||||||||
Set the current buffered position in ms.
| |||||||||||
Set a user readable error message.
| |||||||||||
Set any custom extras to be included with the playback state.
| |||||||||||
Set the current state of playback.
| |||||||||||
Set the current state of playback.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Creates a builder with the same initial values as those in the from state.
from | The state to use for initializing the builder. |
---|
Add a custom action to the playback state. Actions can be used to
expose additional functionality to MediaControllers
beyond what is offered by the standard transport
controls.
e.g. start a radio station based on the current item or skip ahead by 30 seconds.
action | An identifier for this action. It can be sent back to
the MediaSession through
sendCustomAction(String, Bundle) . |
---|---|
name | The display name for the action. If text is shown with the action or used for accessibility, this is what should be used. |
icon | The resource action of the icon that should be displayed
for the action. The resource should be in the package of
the MediaSession . |
Add a custom action to the playback state. Actions can be used to expose additional
functionality to MediaControllers
beyond what is offered by the
standard transport controls.
An example of an action would be to start a radio station based on the current item or to skip ahead by 30 seconds.
customAction | The custom action to add to the PlaybackState . |
---|
Build and return the PlaybackState
instance with these
values.
Set the current actions available on this session. This should use a bitmask of possible actions.
actions | The set of actions allowed. |
---|
Set the active item in the play queue by specifying its id. The
default value is UNKNOWN_ID
id | The id of the active item. |
---|
Set the current buffered position in ms. This is the farthest playback point that can be reached from the current position using only buffered content.
bufferedPosition | The position in ms that playback is buffered to. |
---|
Set a user readable error message. This should be set when the state
is STATE_ERROR
.
error | The error message for display to the user. |
---|
Set any custom extras to be included with the playback state.
extras | The extras to include. |
---|
Set the current state of playback.
The position must be in ms and indicates the current playback
position within the item. If the position is unknown use
PLAYBACK_POSITION_UNKNOWN
. When not using an unknown
position the time at which the position was updated must be provided.
It is okay to use elapsedRealtime()
if the
current position was just retrieved.
The speed is a multiple of normal playback and should be 0 when paused and negative when rewinding. Normal playback speed is 1.0.
The state must be one of the following:
state | The current state of playback. |
---|---|
position | The position in the current item in ms. |
playbackSpeed | The current speed of playback as a multiple of normal playback. |
updateTime | The time in the elapsedRealtime()
timebase that the position was updated at. |
Set the current state of playback.
The position must be in ms and indicates the current playback
position within the item. If the position is unknown use
PLAYBACK_POSITION_UNKNOWN
. The update time will be set to
the current elapsedRealtime()
.
The speed is a multiple of normal playback and should be 0 when paused and negative when rewinding. Normal playback speed is 1.0.
The state must be one of the following:
state | The current state of playback. |
---|---|
position | The position in the current item in ms. |
playbackSpeed | The current speed of playback as a multiple of normal playback. |