Package com.google.android.exoplayer2.testutil

## Class Action

- java.lang.Object
- - com.google.android.exoplayer2.testutil.Action

- Direct Known Subclasses:
    `Action.AddMediaItems`, `Action.ClearMediaItems`, `Action.ClearVideoSurface`, `Action.ExecuteRunnable`, `Action.MoveMediaItem`, `Action.PlayUntilPosition`, `Action.Prepare`, `Action.RemoveMediaItem`, `Action.RemoveMediaItems`, `Action.Seek`, `Action.SendMessages`, `Action.SetAudioAttributes`, `Action.SetMediaItems`, `Action.SetMediaItemsResetPosition`, `Action.SetPlaybackParameters`, `Action.SetPlayWhenReady`, `Action.SetRendererDisabled`, `Action.SetRepeatMode`, `Action.SetShuffleModeEnabled`, `Action.SetShuffleOrder`, `Action.SetVideoSurface`, `Action.Stop`, `Action.ThrowPlaybackException`, `Action.WaitForIsLoading`, `Action.WaitForMessage`, `Action.WaitForPendingPlayerCommands`, `Action.WaitForPlaybackState`, `Action.WaitForPlayWhenReady`, `Action.WaitForPositionDiscontinuity`, `Action.WaitForTimelineChanged`

      public abstract class Action
      extends Object

  Base class for actions to perform during playback tests.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `Action.AddMediaItems` | Calls `SimpleExoPlayer.addMediaSources(List)`.
    `static class` | `Action.ClearMediaItems` | Calls `BasePlayer.clearMediaItems()`}.
    `static class` | `Action.ClearVideoSurface` | Calls `SimpleExoPlayer.clearVideoSurface()`.
    `static class` | `Action.ExecuteRunnable` | Calls `Runnable.run()`.
    `static class` | `Action.MoveMediaItem` | Calls `BasePlayer.moveMediaItem(int, int)`.
    `static class` | `Action.PlayUntilPosition` | Schedules a play action to be executed, waits until the player reaches the specified position, and pauses the player again.
    `static class` | `Action.Prepare` | Calls `Player.prepare()`.
    `static class` | `Action.RemoveMediaItem` | Calls `BasePlayer.removeMediaItem(int)`.
    `static class` | `Action.RemoveMediaItems` | Calls `SimpleExoPlayer.removeMediaItems(int, int)`.
    `static class` | `Action.Seek` | Calls `Player.seekTo(long)` or `Player.seekTo(int, long)`.
    `static class` | `Action.SendMessages` | Calls `ExoPlayer.createMessage(Target)` and `PlayerMessage.send()`.
    `static class` | `Action.SetAudioAttributes` | Calls `SimpleExoPlayer.setAudioAttributes(AudioAttributes, boolean)`.
    `static class` | `Action.SetMediaItems` | Calls `SimpleExoPlayer.setMediaSources(List, int, long)`.
    `static class` | `Action.SetMediaItemsResetPosition` | Calls `SimpleExoPlayer.setMediaSources(List, boolean)`.
    `static class` | `Action.SetPlaybackParameters` | Calls `Player.setPlaybackParameters(PlaybackParameters)`.
    `static class` | `Action.SetPlayWhenReady` | Calls `Player.setPlayWhenReady(boolean)`.
    `static class` | `Action.SetRendererDisabled` | Updates the `DefaultTrackSelector.Parameters` of a `DefaultTrackSelector` to specify whether the renderer at a given index should be disabled.
    `static class` | `Action.SetRepeatMode` | Calls `Player.setRepeatMode(int)`.
    `static class` | `Action.SetShuffleModeEnabled` | Calls `Player.setShuffleModeEnabled(boolean)`.
    `static class` | `Action.SetShuffleOrder` | Calls `ExoPlayer.setShuffleOrder(ShuffleOrder)` .
    `static class` | `Action.SetVideoSurface` | Calls `SimpleExoPlayer.setVideoSurface(Surface)`.
    `static class` | `Action.Stop` | Calls `Player.stop()` or `Player.stop(boolean)`.
    `static class` | `Action.ThrowPlaybackException` | Throws a playback exception on the playback thread.
    `static class` | `Action.WaitForIsLoading` | Waits for a specified loading state, returning either immediately or after a call to `Player.Listener.onIsLoadingChanged(boolean)`.
    `static class` | `Action.WaitForMessage` | Waits for a player message to arrive.
    `static class` | `Action.WaitForPendingPlayerCommands` | Waits until the player acknowledged all pending player commands.
    `static class` | `Action.WaitForPlaybackState` | Waits for a specified playback state, returning either immediately or after a call to `Player.Listener.onPlaybackStateChanged(int)`.
    `static class` | `Action.WaitForPlayWhenReady` | Waits for a specified playWhenReady value, returning either immediately or after a call to `Player.Listener.onPlayWhenReadyChanged(boolean, int)`.
    `static class` | `Action.WaitForPositionDiscontinuity` | Waits for `Player.Listener.onPositionDiscontinuity(Player.PositionInfo, Player.PositionInfo, int)`.
    `static class` | `Action.WaitForTimelineChanged` | Waits for `Player.Listener.onTimelineChanged(Timeline, int)`.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Action​(String tag, String description)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `doActionAndScheduleNext​(SimpleExoPlayer player, DefaultTrackSelector trackSelector, Surface surface, HandlerWrapper handler, com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)` | Executes the action and schedules the next.
    `protected void` | `doActionAndScheduleNextImpl​(SimpleExoPlayer player, DefaultTrackSelector trackSelector, Surface surface, HandlerWrapper handler, com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)` | Called by `doActionAndScheduleNext(SimpleExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)` to perform the action and to schedule the next action node.
    `protected abstract void` | `doActionImpl​(SimpleExoPlayer player, DefaultTrackSelector trackSelector, Surface surface)` | Called by `doActionAndScheduleNextImpl(SimpleExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)` to perform the action.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Action

          public Action​(String tag,
                        @Nullable
                        String description)

      Parameters:
        `tag` - A tag to use for logging.
        `description` - A description to be logged when the action is executed, or null if no logging is required.

  - ### Method Detail

    - #### doActionAndScheduleNext

          public final void doActionAndScheduleNext​(SimpleExoPlayer player,
                                                    DefaultTrackSelector trackSelector,
                                                    @Nullable
                                                    Surface surface,
                                                    HandlerWrapper handler,
                                                    @Nullable
                                                    com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)

      Executes the action and schedules the next.
      Parameters:
        `player` - The player to which the action should be applied.
        `trackSelector` - The track selector to which the action should be applied.
        `surface` - The surface to use when applying actions, or `null` if no surface is needed.
        `handler` - The handler to use to pass to the next action.
        `nextAction` - The next action to schedule immediately after this action finished, or `null` if there's no next action.

    - #### doActionAndScheduleNextImpl

          protected void doActionAndScheduleNextImpl​(SimpleExoPlayer player,
                                                     DefaultTrackSelector trackSelector,
                                                     @Nullable
                                                     Surface surface,
                                                     HandlerWrapper handler,
                                                     @Nullable
                                                     com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)

      Called by `doActionAndScheduleNext(SimpleExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)` to perform the action and to schedule the next action node.
      Parameters:
        `player` - The player to which the action should be applied.
        `trackSelector` - The track selector to which the action should be applied.
        `surface` - The surface to use when applying actions, or `null` if no surface is needed.
        `handler` - The handler to use to pass to the next action.
        `nextAction` - The next action to schedule immediately after this action finished, or `null` if there's no next action.

    - #### doActionImpl

          protected abstract void doActionImpl​(SimpleExoPlayer player,
                                               DefaultTrackSelector trackSelector,
                                               @Nullable
                                               Surface surface)

      Called by `doActionAndScheduleNextImpl(SimpleExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)` to perform the action.
      Parameters:
        `player` - The player to which the action should be applied.
        `trackSelector` - The track selector to which the action should be applied.
        `surface` - The surface to use when applying actions, or `null` if no surface is needed.