# ActionSchedule.Builder

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/ActionSchedule.java+class:androidx.media3.test.utils.ActionSchedule.Builder)

*** ** * ** ***


```
public final class ActionSchedule.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#Builder(java.lang.String)(https://developer.android.com/reference/java/lang/String.html tag)` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#addMediaSources(androidx.media3.exoplayer.source.MediaSource...)(MediaSource[] mediaSources)` Schedules a add media items action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#apply(androidx.media3.test.utils.Action)(https://developer.android.com/reference/androidx/media3/test/utils/Action action)` Schedules an action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule` | `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#build()()` Builds the schedule. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#clearMediaItems()()` Schedules a clear media items action to be created. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#clearVideoSurface()()` Schedules a clear video surface action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#delay(long)(long delayMs)` Schedules a delay between executing any previous actions and any subsequent ones. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#disableRenderer(int)(int index)` Schedules a renderer disable action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#enableRenderer(int)(int index)` Schedules a renderer enable action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#executeRunnable(java.lang.Runnable)(https://developer.android.com/reference/java/lang/Runnable.html runnable)` Schedules a `https://developer.android.com/reference/java/lang/Runnable.html`. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#moveMediaItem(int,int)(int currentIndex, int newIndex)` Schedules a move media item action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#pause()()` Schedules a pause action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#play()()` Schedules a play action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#playUntilPosition(int,long)(int mediaItemIndex, long positionMs)` Schedules a play action, waits until the player reaches the specified position, and pauses the player again. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#playUntilStartOfMediaItem(int)(int mediaItemIndex)` Schedules a play action, waits until the player reaches the start of the specified media item, and pauses the player again. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#prepare()()` Schedules a prepare action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#removeMediaItem(int)(int index)` Schedules a remove media item action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#removeMediaItems(int,int)(int fromIndex, int toIndex)` Schedules a remove media items action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#repeat(androidx.media3.test.utils.Action,long)(https://developer.android.com/reference/androidx/media3/test/utils/Action action, long intervalMs)` Schedules an action repeatedly. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#seek(long)(long positionMs)` Schedules a seek action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#seek(int,long)(int mediaItemIndex, long positionMs)` Schedules a seek action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#seek(int,long,boolean)( int mediaItemIndex, long positionMs, boolean catchIllegalSeekException )` Schedules a seek action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#seekAndWait(long)(long positionMs)` Schedules a seek action and waits until playback resumes after the seek. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#sendMessage(androidx.media3.exoplayer.PlayerMessage.Target,long)(https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target, long positionMs)` Schedules sending a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#sendMessage(androidx.media3.exoplayer.PlayerMessage.Target,int,long)( https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target, int mediaItemIndex, long positionMs )` Schedules sending a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#sendMessage(androidx.media3.exoplayer.PlayerMessage.Target,int,long,boolean)( https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target, int mediaItemIndex, long positionMs, boolean deleteAfterDelivery )` Schedules to send a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` Schedules application of audio attributes. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setMediaSources(androidx.media3.exoplayer.source.MediaSource...)(MediaSource[] mediaSources)` Schedules a set media items action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setMediaSources(boolean,androidx.media3.exoplayer.source.MediaSource...)(boolean resetPosition, MediaSource[] sources)` Schedules a set media sources action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setMediaSources(int,long,androidx.media3.exoplayer.source.MediaSource...)( int mediaItemIndex, long positionMs, MediaSource[] sources )` Schedules a set media source actions to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setPlaybackParameters(androidx.media3.common.PlaybackParameters)(https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters)` Schedules a playback parameters setting action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setRepeatMode(int)(@https://developer.android.com/reference/androidx/media3/common/Player.RepeatMode int repeatMode)` Schedules a repeat mode setting action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setShuffleModeEnabled(boolean)(boolean shuffleModeEnabled)` Schedules a shuffle setting action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setShuffleOrder(androidx.media3.exoplayer.source.ShuffleOrder)(https://developer.android.com/reference/androidx/media3/exoplayer/source/ShuffleOrder shuffleOrder)` Schedules a set shuffle order action to be executed. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#setVideoSurface()()` Schedules a set video surface action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#stop()()` Schedules a stop action. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#throwPlaybackException(androidx.media3.exoplayer.ExoPlaybackException)(https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlaybackException exception)` Schedules to throw a playback exception on the playback thread. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForIsLoading(boolean)(boolean targetIsLoading)` Schedules a delay until `player.isLoading()` changes to the specified value. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForMessage(androidx.media3.test.utils.ActionSchedule.PlayerTarget)(https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget playerTarget)` Schedules a delay until a message arrives at the `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target`. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForPendingPlayerCommands()()` Schedules a delay until all pending player commands have been handled. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForPlayWhenReady(boolean)(boolean targetPlayWhenReady)` Schedules a delay until playWhenReady has the specified value. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForPlaybackState(int)(@https://developer.android.com/reference/androidx/media3/common/Player.State int targetPlaybackState)` Schedules a delay until the playback state changed to the specified state. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForPositionDiscontinuity()()` Schedules a delay until the next position discontinuity. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForTimelineChanged()()` Schedules a delay until any timeline change. |
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForTimelineChanged(androidx.media3.common.Timeline,int)( https://developer.android.com/reference/androidx/media3/common/Timeline expectedTimeline, @https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason int expectedReason )` Schedules a delay until the timeline changed to a specified expected timeline. |

## Public constructors

### Builder

```
public Builder(String tag)
```

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` | A tag to use for logging. |

## Public methods

### addMediaSources

```
@CanIgnoreReturnValue
public ActionSchedule.Builder addMediaSources(MediaSource[] mediaSources)
```

Schedules a add media items action to be executed.

| Parameters |
|---|---|
| `MediaSource[] mediaSources` | The media sources to add. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### apply

```
@CanIgnoreReturnValue
public ActionSchedule.Builder apply(Action action)
```

Schedules an action.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/Action action` | The action to schedule. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### build

```
public ActionSchedule build()
```

Builds the schedule.

### clearMediaItems

```
@CanIgnoreReturnValue
public ActionSchedule.Builder clearMediaItems()
```

Schedules a clear media items action to be created.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder. for convenience, |

### clearVideoSurface

```
@CanIgnoreReturnValue
public ActionSchedule.Builder clearVideoSurface()
```

Schedules a clear video surface action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### delay

```
@CanIgnoreReturnValue
public ActionSchedule.Builder delay(long delayMs)
```

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

| Parameters |
|---|---|
| `long delayMs` | The delay in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### disableRenderer

```
@CanIgnoreReturnValue
public ActionSchedule.Builder disableRenderer(int index)
```

Schedules a renderer disable action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### enableRenderer

```
@CanIgnoreReturnValue
public ActionSchedule.Builder enableRenderer(int index)
```

Schedules a renderer enable action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### executeRunnable

```
@CanIgnoreReturnValue
public ActionSchedule.Builder executeRunnable(Runnable runnable)
```

Schedules a `https://developer.android.com/reference/java/lang/Runnable.html`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### moveMediaItem

```
@CanIgnoreReturnValue
public ActionSchedule.Builder moveMediaItem(int currentIndex, int newIndex)
```

Schedules a move media item action to be executed.

| Parameters |
|---|---|
| `int currentIndex` | The current index of the item to move. |
| `int newIndex` | The index after the item has been moved. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### pause

```
@CanIgnoreReturnValue
public ActionSchedule.Builder pause()
```

Schedules a pause action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### play

```
@CanIgnoreReturnValue
public ActionSchedule.Builder play()
```

Schedules a play action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### playUntilPosition

```
@CanIgnoreReturnValue
public ActionSchedule.Builder playUntilPosition(int mediaItemIndex, long positionMs)
```

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

| Parameters |
|---|---|
| `int mediaItemIndex` | The media item index at which the player should be paused again. |
| `long positionMs` | The position in that media item at which the player should be paused again. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### playUntilStartOfMediaItem

```
@CanIgnoreReturnValue
public ActionSchedule.Builder playUntilStartOfMediaItem(int mediaItemIndex)
```

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

| Parameters |
|---|---|
| `int mediaItemIndex` | The media item index at which the player should be paused again. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### prepare

```
@CanIgnoreReturnValue
public ActionSchedule.Builder prepare()
```

Schedules a prepare action to be executed.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### removeMediaItem

```
@CanIgnoreReturnValue
public ActionSchedule.Builder removeMediaItem(int index)
```

Schedules a remove media item action to be executed.

| Parameters |
|---|---|
| `int index` | The index of the media item to be removed. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### removeMediaItems

```
@CanIgnoreReturnValue
public ActionSchedule.Builder removeMediaItems(int fromIndex, int toIndex)
```

Schedules a remove media items action to be executed.

| Parameters |
|---|---|
| `int fromIndex` | The start of the range of media items to be removed. |
| `int toIndex` | The end of the range of media items to be removed (exclusive). |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### repeat

```
@CanIgnoreReturnValue
public ActionSchedule.Builder repeat(Action action, long intervalMs)
```

Schedules an action repeatedly.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/Action action` | The action to schedule. |
| `long intervalMs` | The interval between each repetition in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### seek

```
@CanIgnoreReturnValue
public ActionSchedule.Builder seek(long positionMs)
```

Schedules a seek action.

| Parameters |
|---|---|
| `long positionMs` | The seek position. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### seek

```
@CanIgnoreReturnValue
public ActionSchedule.Builder seek(int mediaItemIndex, long positionMs)
```

Schedules a seek action.

| Parameters |
|---|---|
| `int mediaItemIndex` | The media item to seek to. |
| `long positionMs` | The seek position. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### seek

```
@CanIgnoreReturnValue
public ActionSchedule.Builder seek(
    int mediaItemIndex,
    long positionMs,
    boolean catchIllegalSeekException
)
```

Schedules a seek action to be executed.

| Parameters |
|---|---|
| `int mediaItemIndex` | The media item to seek to. |
| `long positionMs` | The seek position. |
| `boolean catchIllegalSeekException` | Whether an illegal seek position should be caught or not. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### seekAndWait

```
public ActionSchedule.Builder seekAndWait(long positionMs)
```

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

| Parameters |
|---|---|
| `long positionMs` | The seek position. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### sendMessage

```
@CanIgnoreReturnValue
public ActionSchedule.Builder sendMessage(PlayerMessage.Target target, long positionMs)
```

Schedules sending a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target` | A message target. |
| `long positionMs` | The position in the current media item at which the message should be sent, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### sendMessage

```
@CanIgnoreReturnValue
public ActionSchedule.Builder sendMessage(
    PlayerMessage.Target target,
    int mediaItemIndex,
    long positionMs
)
```

Schedules sending a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target` | A message target. |
| `int mediaItemIndex` | The media item index at which the message should be sent. |
| `long positionMs` | The position at which the message should be sent, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### sendMessage

```
@CanIgnoreReturnValue
public ActionSchedule.Builder sendMessage(
    PlayerMessage.Target target,
    int mediaItemIndex,
    long positionMs,
    boolean deleteAfterDelivery
)
```

Schedules to send a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target target` | A message target. |
| `int mediaItemIndex` | The media item index at which the message should be sent. |
| `long positionMs` | The position at which the message should be sent, in milliseconds. |
| `boolean deleteAfterDelivery` | Whether the message will be deleted after delivery. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setAudioAttributes

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setAudioAttributes(
    AudioAttributes audioAttributes,
    boolean handleAudioFocus
)
```

Schedules application of audio attributes.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setMediaSources

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setMediaSources(MediaSource[] mediaSources)
```

Schedules a set media items action to be executed.

| Parameters |
|---|---|
| `MediaSource[] mediaSources` | The media sources to add. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setMediaSources

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setMediaSources(boolean resetPosition, MediaSource[] sources)
```

Schedules a set media sources action to be executed.

| Parameters |
|---|---|
| `boolean resetPosition` | Whether the playback position should be reset. |
| `MediaSource[] sources` | The media sources to be set on the player. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setMediaSources

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setMediaSources(
    int mediaItemIndex,
    long positionMs,
    MediaSource[] sources
)
```

Schedules a set media source actions to be executed.

| Parameters |
|---|---|
| `int mediaItemIndex` | The media item index to start playback from or `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` if the playback position should not be reset. |
| `long positionMs` | The position in milliseconds from where playback should start. If `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` is passed the default position is used. In any case, if ` mediaItemIndex` is set to `https://developer.android.com/reference/androidx/media3/common/C#INDEX_UNSET()` the position is not reset at all and this parameter is ignored. |
| `MediaSource[] sources` | The media sources to be set on the player. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setPlaybackParameters

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setPlaybackParameters(PlaybackParameters playbackParameters)
```

Schedules a playback parameters setting action.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/PlaybackParameters playbackParameters` | The playback parameters to set. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Player#setPlaybackParameters(androidx.media3.common.PlaybackParameters)` |   |

### setRepeatMode

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setRepeatMode(@Player.RepeatMode int repeatMode)
```

Schedules a repeat mode setting action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setShuffleModeEnabled

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setShuffleModeEnabled(boolean shuffleModeEnabled)
```

Schedules a shuffle setting action to be executed.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setShuffleOrder

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setShuffleOrder(ShuffleOrder shuffleOrder)
```

Schedules a set shuffle order action to be executed.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/ShuffleOrder shuffleOrder` | The shuffle order. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### setVideoSurface

```
@CanIgnoreReturnValue
public ActionSchedule.Builder setVideoSurface()
```

Schedules a set video surface action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### stop

```
@CanIgnoreReturnValue
public ActionSchedule.Builder stop()
```

Schedules a stop action.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### throwPlaybackException

```
@CanIgnoreReturnValue
public ActionSchedule.Builder throwPlaybackException(ExoPlaybackException exception)
```

Schedules to throw a playback exception on the playback thread.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlaybackException exception` | The exception to throw. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForIsLoading

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForIsLoading(boolean targetIsLoading)
```

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

| Parameters |
|---|---|
| `boolean targetIsLoading` | The target value of `player.isLoading()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForMessage

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForMessage(ActionSchedule.PlayerTarget playerTarget)
```

Schedules a delay until a message arrives at the `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget playerTarget` | The target to observe. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForPendingPlayerCommands

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForPendingPlayerCommands()
```

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 |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForPlayWhenReady

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForPlayWhenReady(boolean targetPlayWhenReady)
```

Schedules a delay until playWhenReady has the specified value.

| Parameters |
|---|---|
| `boolean targetPlayWhenReady` | The target playWhenReady value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForPlaybackState

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForPlaybackState(@Player.State int targetPlaybackState)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/Player.State int targetPlaybackState` | The target playback state. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForPositionDiscontinuity

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForPositionDiscontinuity()
```

Schedules a delay until the next position discontinuity.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForTimelineChanged

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForTimelineChanged()
```

Schedules a delay until any timeline change.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |

### waitForTimelineChanged

```
@CanIgnoreReturnValue
public ActionSchedule.Builder waitForTimelineChanged(
    Timeline expectedTimeline,
    @Player.TimelineChangeReason int expectedReason
)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Timeline expectedTimeline` | The expected timeline. |
| `@https://developer.android.com/reference/androidx/media3/common/Player.TimelineChangeReason int expectedReason` | The expected reason of the timeline change. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder` | The builder, for convenience. |