ActionSchedule.Builder


class ActionSchedule.Builder


A builder for ActionSchedule instances.

Summary

Public constructors

Builder(tag: String!)

Public functions

ActionSchedule.Builder!

Schedules a add media items action to be executed.

ActionSchedule.Builder!

Schedules an action.

ActionSchedule!

Builds the schedule.

ActionSchedule.Builder!

Schedules a clear media items action to be created.

ActionSchedule.Builder!

Schedules a clear video surface action.

ActionSchedule.Builder!

Schedules a delay between executing any previous actions and any subsequent ones.

ActionSchedule.Builder!

Schedules a renderer disable action.

ActionSchedule.Builder!

Schedules a renderer enable action.

ActionSchedule.Builder!

Schedules a Runnable.

ActionSchedule.Builder!
@CanIgnoreReturnValue
moveMediaItem(currentIndex: Int, newIndex: Int)

Schedules a move media item action to be executed.

ActionSchedule.Builder!

Schedules a pause action.

ActionSchedule.Builder!

Schedules a play action.

ActionSchedule.Builder!
@CanIgnoreReturnValue
playUntilPosition(mediaItemIndex: Int, positionMs: Long)

Schedules a play action, waits until the player reaches the specified position, and pauses the player again.

ActionSchedule.Builder!

Schedules a play action, waits until the player reaches the start of the specified media item, and pauses the player again.

ActionSchedule.Builder!

Schedules a prepare action to be executed.

ActionSchedule.Builder!

Schedules a remove media item action to be executed.

ActionSchedule.Builder!
@CanIgnoreReturnValue
removeMediaItems(fromIndex: Int, toIndex: Int)

Schedules a remove media items action to be executed.

ActionSchedule.Builder!
@CanIgnoreReturnValue
repeat(action: Action!, intervalMs: Long)

Schedules an action repeatedly.

ActionSchedule.Builder!

Schedules a seek action.

ActionSchedule.Builder!
@CanIgnoreReturnValue
seek(mediaItemIndex: Int, positionMs: Long)

Schedules a seek action.

ActionSchedule.Builder!
@CanIgnoreReturnValue
seek(
    mediaItemIndex: Int,
    positionMs: Long,
    catchIllegalSeekException: Boolean
)

Schedules a seek action to be executed.

ActionSchedule.Builder!
seekAndWait(positionMs: Long)

Schedules a seek action and waits until playback resumes after the seek.

ActionSchedule.Builder!

Schedules sending a PlayerMessage.

ActionSchedule.Builder!
@CanIgnoreReturnValue
sendMessage(
    target: PlayerMessage.Target!,
    mediaItemIndex: Int,
    positionMs: Long
)

Schedules sending a PlayerMessage.

ActionSchedule.Builder!
@CanIgnoreReturnValue
sendMessage(
    target: PlayerMessage.Target!,
    mediaItemIndex: Int,
    positionMs: Long,
    deleteAfterDelivery: Boolean
)

Schedules to send a PlayerMessage.

ActionSchedule.Builder!
@CanIgnoreReturnValue
setAudioAttributes(
    audioAttributes: AudioAttributes!,
    handleAudioFocus: Boolean
)

Schedules application of audio attributes.

ActionSchedule.Builder!

Schedules a set media items action to be executed.

ActionSchedule.Builder!

Schedules a set media sources action to be executed.

ActionSchedule.Builder!
@CanIgnoreReturnValue
setMediaSources(
    mediaItemIndex: Int,
    positionMs: Long,
    sources: Array<MediaSource!>!
)

Schedules a set media source actions to be executed.

ActionSchedule.Builder!

Schedules a playback parameters setting action.

ActionSchedule.Builder!

Schedules a repeat mode setting action.

ActionSchedule.Builder!

Schedules a shuffle setting action to be executed.

ActionSchedule.Builder!

Schedules a set shuffle order action to be executed.

ActionSchedule.Builder!

Schedules a set video surface action.

ActionSchedule.Builder!

Schedules a stop action.

ActionSchedule.Builder!

Schedules to throw a playback exception on the playback thread.

ActionSchedule.Builder!

Schedules a delay until player.isLoading() changes to the specified value.

ActionSchedule.Builder!

Schedules a delay until a message arrives at the PlayerMessage.Target.

ActionSchedule.Builder!

Schedules a delay until all pending player commands have been handled.

ActionSchedule.Builder!

Schedules a delay until playWhenReady has the specified value.

ActionSchedule.Builder!

Schedules a delay until the playback state changed to the specified state.

ActionSchedule.Builder!

Schedules a delay until the next position discontinuity.

ActionSchedule.Builder!

Schedules a delay until any timeline change.

ActionSchedule.Builder!
@CanIgnoreReturnValue
waitForTimelineChanged(
    expectedTimeline: Timeline!,
    @Player.TimelineChangeReason expectedReason: Int
)

Schedules a delay until the timeline changed to a specified expected timeline.

Public constructors

Builder

Builder(tag: String!)
Parameters
tag: String!

A tag to use for logging.

Public functions

addMediaSources

@CanIgnoreReturnValue
fun addMediaSources(mediaSources: Array<MediaSource!>!): ActionSchedule.Builder!

Schedules a add media items action to be executed.

Parameters
mediaSources: Array<MediaSource!>!

The media sources to add.

Returns
ActionSchedule.Builder!

The builder, for convenience.

apply

@CanIgnoreReturnValue
fun apply(action: Action!): ActionSchedule.Builder!

Schedules an action.

Parameters
action: Action!

The action to schedule.

Returns
ActionSchedule.Builder!

The builder, for convenience.

build

fun build(): ActionSchedule!

Builds the schedule.

clearMediaItems

@CanIgnoreReturnValue
fun clearMediaItems(): ActionSchedule.Builder!

Schedules a clear media items action to be created.

Returns
ActionSchedule.Builder!

The builder. for convenience,

clearVideoSurface

@CanIgnoreReturnValue
fun clearVideoSurface(): ActionSchedule.Builder!

Schedules a clear video surface action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

delay

@CanIgnoreReturnValue
fun delay(delayMs: Long): ActionSchedule.Builder!

Schedules a delay between executing any previous actions and any subsequent ones.

Parameters
delayMs: Long

The delay in milliseconds.

Returns
ActionSchedule.Builder!

The builder, for convenience.

disableRenderer

@CanIgnoreReturnValue
fun disableRenderer(index: Int): ActionSchedule.Builder!

Schedules a renderer disable action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

enableRenderer

@CanIgnoreReturnValue
fun enableRenderer(index: Int): ActionSchedule.Builder!

Schedules a renderer enable action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

executeRunnable

@CanIgnoreReturnValue
fun executeRunnable(runnable: Runnable!): ActionSchedule.Builder!

Schedules a Runnable.

Returns
ActionSchedule.Builder!

The builder, for convenience.

moveMediaItem

@CanIgnoreReturnValue
fun moveMediaItem(currentIndex: Int, newIndex: Int): ActionSchedule.Builder!

Schedules a move media item action to be executed.

Parameters
currentIndex: Int

The current index of the item to move.

newIndex: Int

The index after the item has been moved.

Returns
ActionSchedule.Builder!

The builder, for convenience.

pause

@CanIgnoreReturnValue
fun pause(): ActionSchedule.Builder!

Schedules a pause action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

play

@CanIgnoreReturnValue
fun play(): ActionSchedule.Builder!

Schedules a play action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

playUntilPosition

@CanIgnoreReturnValue
fun playUntilPosition(mediaItemIndex: Int, positionMs: Long): ActionSchedule.Builder!

Schedules a play action, waits until the player reaches the specified position, and pauses the player again.

Parameters
mediaItemIndex: Int

The media item index at which the player should be paused again.

positionMs: Long

The position in that media item at which the player should be paused again.

Returns
ActionSchedule.Builder!

The builder, for convenience.

playUntilStartOfMediaItem

@CanIgnoreReturnValue
fun playUntilStartOfMediaItem(mediaItemIndex: Int): ActionSchedule.Builder!

Schedules a play action, waits until the player reaches the start of the specified media item, and pauses the player again.

Parameters
mediaItemIndex: Int

The media item index at which the player should be paused again.

Returns
ActionSchedule.Builder!

The builder, for convenience.

prepare

@CanIgnoreReturnValue
fun prepare(): ActionSchedule.Builder!

Schedules a prepare action to be executed.

Returns
ActionSchedule.Builder!

The builder, for convenience.

removeMediaItem

@CanIgnoreReturnValue
fun removeMediaItem(index: Int): ActionSchedule.Builder!

Schedules a remove media item action to be executed.

Parameters
index: Int

The index of the media item to be removed.

Returns
ActionSchedule.Builder!

The builder, for convenience.

removeMediaItems

@CanIgnoreReturnValue
fun removeMediaItems(fromIndex: Int, toIndex: Int): ActionSchedule.Builder!

Schedules a remove media items action to be executed.

Parameters
fromIndex: Int

The start of the range of media items to be removed.

toIndex: Int

The end of the range of media items to be removed (exclusive).

Returns
ActionSchedule.Builder!

The builder, for convenience.

repeat

@CanIgnoreReturnValue
fun repeat(action: Action!, intervalMs: Long): ActionSchedule.Builder!

Schedules an action repeatedly.

Parameters
action: Action!

The action to schedule.

intervalMs: Long

The interval between each repetition in milliseconds.

Returns
ActionSchedule.Builder!

The builder, for convenience.

seek

@CanIgnoreReturnValue
fun seek(positionMs: Long): ActionSchedule.Builder!

Schedules a seek action.

Parameters
positionMs: Long

The seek position.

Returns
ActionSchedule.Builder!

The builder, for convenience.

seek

@CanIgnoreReturnValue
fun seek(mediaItemIndex: Int, positionMs: Long): ActionSchedule.Builder!

Schedules a seek action.

Parameters
mediaItemIndex: Int

The media item to seek to.

positionMs: Long

The seek position.

Returns
ActionSchedule.Builder!

The builder, for convenience.

seek

@CanIgnoreReturnValue
fun seek(
    mediaItemIndex: Int,
    positionMs: Long,
    catchIllegalSeekException: Boolean
): ActionSchedule.Builder!

Schedules a seek action to be executed.

Parameters
mediaItemIndex: Int

The media item to seek to.

positionMs: Long

The seek position.

catchIllegalSeekException: Boolean

Whether an illegal seek position should be caught or not.

Returns
ActionSchedule.Builder!

The builder, for convenience.

seekAndWait

fun seekAndWait(positionMs: Long): ActionSchedule.Builder!

Schedules a seek action and waits until playback resumes after the seek.

Parameters
positionMs: Long

The seek position.

Returns
ActionSchedule.Builder!

The builder, for convenience.

sendMessage

@CanIgnoreReturnValue
fun sendMessage(target: PlayerMessage.Target!, positionMs: Long): ActionSchedule.Builder!

Schedules sending a PlayerMessage.

Parameters
target: PlayerMessage.Target!

A message target.

positionMs: Long

The position in the current media item at which the message should be sent, in milliseconds.

Returns
ActionSchedule.Builder!

The builder, for convenience.

sendMessage

@CanIgnoreReturnValue
fun sendMessage(
    target: PlayerMessage.Target!,
    mediaItemIndex: Int,
    positionMs: Long
): ActionSchedule.Builder!

Schedules sending a PlayerMessage.

Parameters
target: PlayerMessage.Target!

A message target.

mediaItemIndex: Int

The media item index at which the message should be sent.

positionMs: Long

The position at which the message should be sent, in milliseconds.

Returns
ActionSchedule.Builder!

The builder, for convenience.

sendMessage

@CanIgnoreReturnValue
fun sendMessage(
    target: PlayerMessage.Target!,
    mediaItemIndex: Int,
    positionMs: Long,
    deleteAfterDelivery: Boolean
): ActionSchedule.Builder!

Schedules to send a PlayerMessage.

Parameters
target: PlayerMessage.Target!

A message target.

mediaItemIndex: Int

The media item index at which the message should be sent.

positionMs: Long

The position at which the message should be sent, in milliseconds.

deleteAfterDelivery: Boolean

Whether the message will be deleted after delivery.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setAudioAttributes

@CanIgnoreReturnValue
fun setAudioAttributes(
    audioAttributes: AudioAttributes!,
    handleAudioFocus: Boolean
): ActionSchedule.Builder!

Schedules application of audio attributes.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setMediaSources

@CanIgnoreReturnValue
fun setMediaSources(mediaSources: Array<MediaSource!>!): ActionSchedule.Builder!

Schedules a set media items action to be executed.

Parameters
mediaSources: Array<MediaSource!>!

The media sources to add.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setMediaSources

@CanIgnoreReturnValue
fun setMediaSources(resetPosition: Boolean, sources: Array<MediaSource!>!): ActionSchedule.Builder!

Schedules a set media sources action to be executed.

Parameters
resetPosition: Boolean

Whether the playback position should be reset.

sources: Array<MediaSource!>!

The media sources to be set on the player.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setMediaSources

@CanIgnoreReturnValue
fun setMediaSources(
    mediaItemIndex: Int,
    positionMs: Long,
    sources: Array<MediaSource!>!
): ActionSchedule.Builder!

Schedules a set media source actions to be executed.

Parameters
mediaItemIndex: Int

The media item index to start playback from or INDEX_UNSET if the playback position should not be reset.

positionMs: Long

The position in milliseconds from where playback should start. If TIME_UNSET is passed the default position is used. In any case, if mediaItemIndex is set to INDEX_UNSET the position is not reset at all and this parameter is ignored.

sources: Array<MediaSource!>!

The media sources to be set on the player.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setPlaybackParameters

@CanIgnoreReturnValue
fun setPlaybackParameters(playbackParameters: PlaybackParameters!): ActionSchedule.Builder!

Schedules a playback parameters setting action.

Parameters
playbackParameters: PlaybackParameters!

The playback parameters to set.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setRepeatMode

@CanIgnoreReturnValue
fun setRepeatMode(@Player.RepeatMode repeatMode: Int): ActionSchedule.Builder!

Schedules a repeat mode setting action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setShuffleModeEnabled

@CanIgnoreReturnValue
fun setShuffleModeEnabled(shuffleModeEnabled: Boolean): ActionSchedule.Builder!

Schedules a shuffle setting action to be executed.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setShuffleOrder

@CanIgnoreReturnValue
fun setShuffleOrder(shuffleOrder: ShuffleOrder!): ActionSchedule.Builder!

Schedules a set shuffle order action to be executed.

Parameters
shuffleOrder: ShuffleOrder!

The shuffle order.

Returns
ActionSchedule.Builder!

The builder, for convenience.

setVideoSurface

@CanIgnoreReturnValue
fun setVideoSurface(): ActionSchedule.Builder!

Schedules a set video surface action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

stop

@CanIgnoreReturnValue
fun stop(): ActionSchedule.Builder!

Schedules a stop action.

Returns
ActionSchedule.Builder!

The builder, for convenience.

throwPlaybackException

@CanIgnoreReturnValue
fun throwPlaybackException(exception: ExoPlaybackException!): ActionSchedule.Builder!

Schedules to throw a playback exception on the playback thread.

Parameters
exception: ExoPlaybackException!

The exception to throw.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForIsLoading

@CanIgnoreReturnValue
fun waitForIsLoading(targetIsLoading: Boolean): ActionSchedule.Builder!

Schedules a delay until player.isLoading() changes to the specified value.

Parameters
targetIsLoading: Boolean

The target value of player.isLoading().

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForMessage

@CanIgnoreReturnValue
fun waitForMessage(playerTarget: ActionSchedule.PlayerTarget!): ActionSchedule.Builder!

Schedules a delay until a message arrives at the PlayerMessage.Target.

Parameters
playerTarget: ActionSchedule.PlayerTarget!

The target to observe.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForPendingPlayerCommands

@CanIgnoreReturnValue
fun waitForPendingPlayerCommands(): ActionSchedule.Builder!

Schedules a delay until all pending player commands have been handled.

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.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForPlayWhenReady

@CanIgnoreReturnValue
fun waitForPlayWhenReady(targetPlayWhenReady: Boolean): ActionSchedule.Builder!

Schedules a delay until playWhenReady has the specified value.

Parameters
targetPlayWhenReady: Boolean

The target playWhenReady value.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForPlaybackState

@CanIgnoreReturnValue
fun waitForPlaybackState(@Player.State targetPlaybackState: Int): ActionSchedule.Builder!

Schedules a delay until the playback state changed to the specified state.

Parameters
@Player.State targetPlaybackState: Int

The target playback state.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForPositionDiscontinuity

@CanIgnoreReturnValue
fun waitForPositionDiscontinuity(): ActionSchedule.Builder!

Schedules a delay until the next position discontinuity.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForTimelineChanged

@CanIgnoreReturnValue
fun waitForTimelineChanged(): ActionSchedule.Builder!

Schedules a delay until any timeline change.

Returns
ActionSchedule.Builder!

The builder, for convenience.

waitForTimelineChanged

@CanIgnoreReturnValue
fun waitForTimelineChanged(
    expectedTimeline: Timeline!,
    @Player.TimelineChangeReason expectedReason: Int
): ActionSchedule.Builder!

Schedules a delay until the timeline changed to a specified expected timeline.

Parameters
expectedTimeline: Timeline!

The expected timeline.

@Player.TimelineChangeReason expectedReason: Int

The expected reason of the timeline change.

Returns
ActionSchedule.Builder!

The builder, for convenience.