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
static class
Action.ClearMediaItems
CallsPlayer.clearMediaItems()
}.static class
Action.ClearVideoSurface
CallsPlayer.clearVideoSurface()
.static class
Action.ExecuteRunnable
CallsRunnable.run()
.static class
Action.MoveMediaItem
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
CallsPlayer.prepare()
.static class
Action.RemoveMediaItem
CallsPlayer.removeMediaItem(int)
.static class
Action.RemoveMediaItems
static class
Action.Seek
CallsPlayer.seekTo(long)
orPlayer.seekTo(int, long)
.static class
Action.SendMessages
static class
Action.SetAudioAttributes
static class
Action.SetMediaItems
static class
Action.SetMediaItemsResetPosition
static class
Action.SetPlaybackParameters
static class
Action.SetPlayWhenReady
static class
Action.SetRendererDisabled
Updates theDefaultTrackSelector.Parameters
of aDefaultTrackSelector
to specify whether the renderer at a given index should be disabled.static class
Action.SetRepeatMode
CallsPlayer.setRepeatMode(int)
.static class
Action.SetShuffleModeEnabled
static class
Action.SetShuffleOrder
static class
Action.SetVideoSurface
static class
Action.Stop
CallsPlayer.stop()
orPlayer.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 toPlayer.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 toPlayer.Listener.onPlaybackStateChanged(int)
.static class
Action.WaitForPlayWhenReady
Waits for a specified playWhenReady value, returning either immediately or after a call toPlayer.Listener.onPlayWhenReadyChanged(boolean, int)
.static class
Action.WaitForPositionDiscontinuity
static class
Action.WaitForTimelineChanged
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
doActionAndScheduleNext(ExoPlayer 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(ExoPlayer player, DefaultTrackSelector trackSelector, Surface surface, HandlerWrapper handler, com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)
Called bydoActionAndScheduleNext(ExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)
to perform the action and to schedule the next action node.protected abstract void
doActionImpl(ExoPlayer player, DefaultTrackSelector trackSelector, Surface surface)
Called bydoActionAndScheduleNextImpl(ExoPlayer, DefaultTrackSelector, Surface, HandlerWrapper, ActionNode)
to perform the action.
-
-
-
Method Detail
-
doActionAndScheduleNext
public final void doActionAndScheduleNext(ExoPlayer 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, ornull
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, ornull
if there's no next action.
-
doActionAndScheduleNextImpl
protected void doActionAndScheduleNextImpl(ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, HandlerWrapper handler, @Nullable com.google.android.exoplayer2.testutil.ActionSchedule.ActionNode nextAction)
Called bydoActionAndScheduleNext(ExoPlayer, 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, ornull
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, ornull
if there's no next action.
-
doActionImpl
protected abstract void doActionImpl(ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface)
Called bydoActionAndScheduleNextImpl(ExoPlayer, 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, ornull
if no surface is needed.
-
-