public static final class AVPlaybackState.Builder extends Object
AVPlaybackState to construct instances.| 构造器 | 说明 |
|---|---|
Builder() |
Creates an empty
Builder instance. |
Builder(AVPlaybackState from) |
Creates a
Builder instance from a specified AVPlaybackState instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
AVPlaybackState.Builder |
addAVPlaybackCustomAction(String action,
String name,
int icon) |
Adds a custom action.
|
AVPlaybackState.Builder |
addAVPlaybackCustomAction(AVPlaybackState.AVPlaybackCustomAction customAction) |
Adds a custom action.
|
AVPlaybackState |
build() |
Creates an
AVPlaybackState instance. |
AVPlaybackState.Builder |
setActiveQueueElementId(long id) |
Sets the ID of the active media item in the playback queue.
|
AVPlaybackState.Builder |
setAVPlaybackActions(long actions) |
Sets the actions supported by this
AVSession instance. |
AVPlaybackState.Builder |
setAVPlaybackErrorMessage(CharSequence error) |
Sets the message displayed when an error occurs during playback.
|
AVPlaybackState.Builder |
setAVPlaybackState(int state,
long position,
float speed) |
Sets the playback state, including the position and speed.
|
AVPlaybackState.Builder |
setAVPlaybackState(int state,
long position,
float speed,
long updateTime) |
Sets the playback state, including the position, speed, and position update time.
|
AVPlaybackState.Builder |
setCurrentBufferedPosition(long bufferedPosition) |
Sets the buffer's position.
|
AVPlaybackState.Builder |
setOptions(PacMap options) |
Sets any custom option in this playback state.
|
public Builder()
Builder instance.public Builder(AVPlaybackState from)
Builder instance from a specified AVPlaybackState instance.from - Indicates the AVPlaybackState instance used to create the Builder instance.public AVPlaybackState.Builder setAVPlaybackState(int state, long position, float speed, long updateTime)
If the position is unknown, use AVPlaybackState.PLAYBACK_POSITION_ERROR; otherwise, specify the position update
time.
state - Indicates the state. Available states are as follows:
AVPlaybackState.PLAYBACK_STATE_NONEAVPlaybackState.PLAYBACK_STATE_STOPPEDAVPlaybackState.PLAYBACK_STATE_PAUSEDAVPlaybackState.PLAYBACK_STATE_PLAYINGAVPlaybackState.PLAYBACK_STATE_FAST_FORWARDINGAVPlaybackState.PLAYBACK_STATE_REWINDINGAVPlaybackState.PLAYBACK_STATE_BUFFERINGAVPlaybackState.PLAYBACK_STATE_ERRORAVPlaybackState.PLAYBACK_STATE_CONNECTINGAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_PREVIOUSAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_NEXTAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_QUEUE_ITEMposition - Indicates the current playback position (milliseconds).speed - Indicates the current playback speed.updateTime - Indicates the position update time.Builder instance.public AVPlaybackState.Builder setAVPlaybackState(int state, long position, float speed)
state - Indicates the state. Available states are as follows:
AVPlaybackState.PLAYBACK_STATE_NONEAVPlaybackState.PLAYBACK_STATE_STOPPEDAVPlaybackState.PLAYBACK_STATE_PAUSEDAVPlaybackState.PLAYBACK_STATE_PLAYINGAVPlaybackState.PLAYBACK_STATE_FAST_FORWARDINGAVPlaybackState.PLAYBACK_STATE_REWINDINGAVPlaybackState.PLAYBACK_STATE_BUFFERINGAVPlaybackState.PLAYBACK_STATE_ERRORAVPlaybackState.PLAYBACK_STATE_CONNECTINGAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_PREVIOUSAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_NEXTAVPlaybackState.PLAYBACK_STATE_SKIPPING_TO_QUEUE_ITEMposition - Indicates the current playback position (milliseconds).speed - Indicates the current playback speed.Builder instance.public AVPlaybackState.Builder setAVPlaybackActions(long actions)
AVSession instance. Available actions are as follows:
AVPlaybackState.PLAYBACK_ACTION_STOPAVPlaybackState.PLAYBACK_ACTION_PAUSEAVPlaybackState.PLAYBACK_ACTION_PLAYAVPlaybackState.PLAYBACK_ACTION_REWINDAVPlaybackState.PLAYBACK_ACTION_SKIP_TO_PREVIOUSAVPlaybackState.PLAYBACK_ACTION_SKIP_TO_NEXTAVPlaybackState.PLAYBACK_ACTION_FAST_FORWARDAVPlaybackState.PLAYBACK_ACTION_SET_RATINGAVPlaybackState.PLAYBACK_ACTION_SEEK_TOAVPlaybackState.PLAYBACK_ACTION_PLAY_PAUSEAVPlaybackState.PLAYBACK_ACTION_PLAY_FROM_MEDIA_IDAVPlaybackState.PLAYBACK_ACTION_PLAY_FROM_SEARCHAVPlaybackState.PLAYBACK_ACTION_SKIP_TO_QUEUE_ITEMAVPlaybackState.PLAYBACK_ACTION_PLAY_FROM_URIAVPlaybackState.PLAYBACK_ACTION_PREPAREAVPlaybackState.PLAYBACK_ACTION_PREPARE_FROM_MEDIA_IDAVPlaybackState.PLAYBACK_ACTION_PREPARE_FROM_SEARCHAVPlaybackState.PLAYBACK_ACTION_PREPARE_FROM_URIactions - Indicates the actions supported.Builder instance.public AVPlaybackState.Builder addAVPlaybackCustomAction(String action, String name, int icon)
action - Indicates the ID of the action.name - Indicates the display name of the action.icon - Indicates the ID of the icon to be displayed for the action.Builder instance.public AVPlaybackState.Builder addAVPlaybackCustomAction(AVPlaybackState.AVPlaybackCustomAction customAction)
customAction - Indicates the custom action to add.Builder instance.public AVPlaybackState.Builder setCurrentBufferedPosition(long bufferedPosition)
bufferedPosition - Indicates the buffer's position (milliseconds).Builder instance.public AVPlaybackState.Builder setActiveQueueElementId(long id)
id - Indicates the ID of the active media item.Builder instance.public AVPlaybackState.Builder setAVPlaybackErrorMessage(CharSequence error)
AVPlaybackState.PLAYBACK_STATE_ERROR.error - Indicates the error message.Builder instance.public AVPlaybackState.Builder setOptions(PacMap options)
options - Indicates the custom option to set.Builder instance.public AVPlaybackState build()
AVPlaybackState instance.AVPlaybackState instance.