public static final class ActionSchedule.Builder extends Object
ActionSchedule instances.| Modifier and Type | Method | Description |
|---|---|---|
ActionSchedule.Builder |
addMediaSources(MediaSource... mediaSources) |
Schedules a add media items action to be executed.
|
ActionSchedule.Builder |
apply(Action action) |
Schedules an action.
|
ActionSchedule |
build() |
Builds the schedule.
|
ActionSchedule.Builder |
clearMediaItems() |
Schedules a clear media items action to be created.
|
ActionSchedule.Builder |
clearVideoSurface() |
Schedules a clear video surface action.
|
ActionSchedule.Builder |
delay(long delayMs) |
Schedules a delay between executing any previous actions and any subsequent ones.
|
ActionSchedule.Builder |
disableRenderer(int index) |
Schedules a renderer disable action.
|
ActionSchedule.Builder |
enableRenderer(int index) |
Schedules a renderer enable action.
|
ActionSchedule.Builder |
executeRunnable(Runnable runnable) |
Schedules a
Runnable. |
ActionSchedule.Builder |
moveMediaItem(int currentIndex,
int newIndex) |
Schedules a move media item action to be executed.
|
ActionSchedule.Builder |
pause() |
Schedules a pause action.
|
ActionSchedule.Builder |
play() |
Schedules a play action.
|
ActionSchedule.Builder |
playUntilPosition(int windowIndex,
long positionMs) |
Schedules a play action, waits until the player reaches the specified position, and pauses
the player again.
|
ActionSchedule.Builder |
playUntilStartOfWindow(int windowIndex) |
Schedules a play action, waits until the player reaches the start of the specified window,
and pauses the player again.
|
ActionSchedule.Builder |
prepare() |
Schedules a prepare action to be executed.
|
ActionSchedule.Builder |
removeMediaItem(int index) |
Schedules a remove media item action to be executed.
|
ActionSchedule.Builder |
removeMediaItems(int fromIndex,
int toIndex) |
Schedules a remove media items action to be executed.
|
ActionSchedule.Builder |
repeat(Action action,
long intervalMs) |
Schedules an action repeatedly.
|
ActionSchedule.Builder |
seek(int windowIndex,
long positionMs) |
Schedules a seek action.
|
ActionSchedule.Builder |
seek(int windowIndex,
long positionMs,
boolean catchIllegalSeekException) |
Schedules a seek action to be executed.
|
ActionSchedule.Builder |
seek(long positionMs) |
Schedules a seek action.
|
ActionSchedule.Builder |
seekAndWait(long positionMs) |
Schedules a seek action and waits until playback resumes after the seek.
|
ActionSchedule.Builder |
sendMessage(PlayerMessage.Target target,
int windowIndex,
long positionMs) |
Schedules sending a
PlayerMessage. |
ActionSchedule.Builder |
sendMessage(PlayerMessage.Target target,
int windowIndex,
long positionMs,
boolean deleteAfterDelivery) |
Schedules to send a
PlayerMessage. |
ActionSchedule.Builder |
sendMessage(PlayerMessage.Target target,
long positionMs) |
Schedules sending a
PlayerMessage. |
ActionSchedule.Builder |
setAudioAttributes(AudioAttributes audioAttributes,
boolean handleAudioFocus) |
Schedules application of audio attributes.
|
ActionSchedule.Builder |
setMediaSources(boolean resetPosition,
MediaSource... sources) |
Schedules a set media items action to be executed.
|
ActionSchedule.Builder |
setMediaSources(int windowIndex,
long positionMs,
MediaSource... sources) |
Schedules a set media items action to be executed.
|
ActionSchedule.Builder |
setMediaSources(MediaSource... mediaSources) |
Schedules a set media items action to be executed.
|
ActionSchedule.Builder |
setPlaybackParameters(PlaybackParameters playbackParameters) |
Schedules a playback parameters setting action.
|
ActionSchedule.Builder |
setRepeatMode(int repeatMode) |
Schedules a repeat mode setting action.
|
ActionSchedule.Builder |
setShuffleModeEnabled(boolean shuffleModeEnabled) |
Schedules a shuffle setting action to be executed.
|
ActionSchedule.Builder |
setShuffleOrder(ShuffleOrder shuffleOrder) |
Schedules a set shuffle order action to be executed.
|
ActionSchedule.Builder |
setVideoSurface() |
Schedules a set video surface action.
|
ActionSchedule.Builder |
stop() |
Schedules a stop action.
|
ActionSchedule.Builder |
stop(boolean reset) |
Schedules a stop action.
|
ActionSchedule.Builder |
throwPlaybackException(ExoPlaybackException exception) |
Schedules to throw a playback exception on the playback thread.
|
ActionSchedule.Builder |
waitForIsLoading(boolean targetIsLoading) |
Schedules a delay until
player.isLoading() changes to the specified value. |
ActionSchedule.Builder |
waitForMessage(ActionSchedule.PlayerTarget playerTarget) |
Schedules a delay until a message arrives at the
PlayerMessage.Target. |
ActionSchedule.Builder |
waitForPendingPlayerCommands() |
Schedules a delay until all pending player commands have been handled.
|
ActionSchedule.Builder |
waitForPlaybackState(int targetPlaybackState) |
Schedules a delay until the playback state changed to the specified state.
|
ActionSchedule.Builder |
waitForPlayWhenReady(boolean targetPlayWhenReady) |
Schedules a delay until playWhenReady has the specified value.
|
ActionSchedule.Builder |
waitForPositionDiscontinuity() |
Schedules a delay until the next position discontinuity.
|
ActionSchedule.Builder |
waitForTimelineChanged() |
Schedules a delay until any timeline change.
|
ActionSchedule.Builder |
waitForTimelineChanged(Timeline expectedTimeline,
int expectedReason) |
Schedules a delay until the timeline changed to a specified expected timeline.
|
public Builder(String tag)
tag - A tag to use for logging.public ActionSchedule.Builder delay(long delayMs)
delayMs - The delay in milliseconds.public ActionSchedule.Builder apply(Action action)
action - The action to schedule.public ActionSchedule.Builder repeat(Action action, long intervalMs)
action - The action to schedule.intervalMs - The interval between each repetition in milliseconds.public ActionSchedule.Builder seek(long positionMs)
positionMs - The seek position.public ActionSchedule.Builder seek(int windowIndex, long positionMs)
windowIndex - The window to seek to.positionMs - The seek position.public ActionSchedule.Builder seek(int windowIndex, long positionMs, boolean catchIllegalSeekException)
windowIndex - The window to seek to.positionMs - The seek position.catchIllegalSeekException - Whether an illegal seek position should be caught or not.public ActionSchedule.Builder seekAndWait(long positionMs)
positionMs - The seek position.public ActionSchedule.Builder waitForPendingPlayerCommands()
A command is considered as having been handled if it arrived on the playback thread and the player acknowledged that it received the command back to the app thread.
public ActionSchedule.Builder setPlaybackParameters(PlaybackParameters playbackParameters)
playbackParameters - The playback parameters to set.Player.setPlaybackParameters(PlaybackParameters)public ActionSchedule.Builder stop()
public ActionSchedule.Builder stop(boolean reset)
reset - Whether the player should be reset.public ActionSchedule.Builder play()
public ActionSchedule.Builder playUntilPosition(int windowIndex, long positionMs)
windowIndex - The window index at which the player should be paused again.positionMs - The position in that window at which the player should be paused again.public ActionSchedule.Builder playUntilStartOfWindow(int windowIndex)
windowIndex - The window index at which the player should be paused again.public ActionSchedule.Builder pause()
public ActionSchedule.Builder enableRenderer(int index)
public ActionSchedule.Builder disableRenderer(int index)
public ActionSchedule.Builder clearVideoSurface()
public ActionSchedule.Builder setVideoSurface()
public ActionSchedule.Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus)
public ActionSchedule.Builder setMediaSources(int windowIndex, long positionMs, MediaSource... sources)
windowIndex - The window index to start playback from or C.INDEX_UNSET if the
playback position should not be reset.positionMs - The position in milliseconds from where playback should start. If C.TIME_UNSET is passed the default position is used. In any case, if windowIndex
is set to C.INDEX_UNSET the position is not reset at all and this parameter is
ignored.public ActionSchedule.Builder setMediaSources(boolean resetPosition, MediaSource... sources)
resetPosition - Whether the playback position should be reset.public ActionSchedule.Builder setMediaSources(MediaSource... mediaSources)
mediaSources - The media sources to add.public ActionSchedule.Builder addMediaSources(MediaSource... mediaSources)
mediaSources - The media sources to add.public ActionSchedule.Builder moveMediaItem(int currentIndex, int newIndex)
currentIndex - The current index of the item to move.newIndex - The index after the item has been moved.public ActionSchedule.Builder removeMediaItem(int index)
index - The index of the media item to be removed.public ActionSchedule.Builder removeMediaItems(int fromIndex, int toIndex)
fromIndex - The start of the range of media items to be removed.toIndex - The end of the range of media items to be removed (exclusive).public ActionSchedule.Builder prepare()
public ActionSchedule.Builder clearMediaItems()
public ActionSchedule.Builder setRepeatMode(@RepeatMode int repeatMode)
public ActionSchedule.Builder setShuffleOrder(ShuffleOrder shuffleOrder)
shuffleOrder - The shuffle order.public ActionSchedule.Builder setShuffleModeEnabled(boolean shuffleModeEnabled)
public ActionSchedule.Builder sendMessage(PlayerMessage.Target target, long positionMs)
PlayerMessage.positionMs - The position in the current window at which the message should be sent, in
milliseconds.public ActionSchedule.Builder sendMessage(PlayerMessage.Target target, int windowIndex, long positionMs)
PlayerMessage.target - A message target.windowIndex - The window index at which the message should be sent.positionMs - The position at which the message should be sent, in milliseconds.public ActionSchedule.Builder sendMessage(PlayerMessage.Target target, int windowIndex, long positionMs, boolean deleteAfterDelivery)
PlayerMessage.target - A message target.windowIndex - The window index at which the message should be sent.positionMs - The position at which the message should be sent, in milliseconds.deleteAfterDelivery - Whether the message will be deleted after delivery.public ActionSchedule.Builder waitForTimelineChanged()
public ActionSchedule.Builder waitForTimelineChanged(Timeline expectedTimeline, @TimelineChangeReason int expectedReason)
expectedTimeline - The expected timeline.expectedReason - The expected reason of the timeline change.public ActionSchedule.Builder waitForPositionDiscontinuity()
public ActionSchedule.Builder waitForPlayWhenReady(boolean targetPlayWhenReady)
targetPlayWhenReady - The target playWhenReady value.public ActionSchedule.Builder waitForPlaybackState(@State int targetPlaybackState)
targetPlaybackState - The target playback state.public ActionSchedule.Builder waitForIsLoading(boolean targetIsLoading)
player.isLoading() changes to the specified value.targetIsLoading - The target value of player.isLoading().public ActionSchedule.Builder waitForMessage(ActionSchedule.PlayerTarget playerTarget)
PlayerMessage.Target.playerTarget - The target to observe.public ActionSchedule.Builder executeRunnable(Runnable runnable)
Runnable.public ActionSchedule.Builder throwPlaybackException(ExoPlaybackException exception)
exception - The exception to throw.public ActionSchedule build()