public class TestExoPlayer extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
TestExoPlayer.Builder |
A builder of
SimpleExoPlayer instances for testing. |
Modifier and Type | Method | Description |
---|---|---|
static void |
playUntilPosition(ExoPlayer player,
int windowIndex,
long positionMs) |
Calls
Player.play() , runs tasks of the main Looper until the player
reaches the specified position and then pauses the player . |
static void |
playUntilStartOfWindow(ExoPlayer player,
int windowIndex) |
Calls
Player.play() , runs tasks of the main Looper until the player
reaches the specified window and then pauses the player . |
static ExoPlaybackException |
runUntilError(Player player) |
Runs tasks of the main
Looper until a player error occurred. |
static void |
runUntilPendingCommandsAreFullyHandled(ExoPlayer player) |
Runs tasks of the main
Looper until the player completely handled all previously issued
commands on the internal playback thread. |
static void |
runUntilPlaybackState(Player player,
int expectedState) |
Runs tasks of the main
Looper until Player.getPlaybackState() matches the
expected state. |
static void |
runUntilPlayWhenReady(Player player,
boolean expectedPlayWhenReady) |
Runs tasks of the main
Looper until Player.getPlayWhenReady() matches the
expected value. |
static void |
runUntilPositionDiscontinuity(Player player,
int expectedReason) |
Runs tasks of the main
Looper until a Player.EventListener.onPositionDiscontinuity(int) callback with the specified Player.DiscontinuityReason occurred. |
static boolean |
runUntilReceiveOffloadSchedulingEnabledNewState(Player player) |
Runs tasks of the main
Looper until a Player.EventListener.onExperimentalOffloadSchedulingEnabledChanged(boolean) callback occurred. |
static void |
runUntilRenderedFirstFrame(SimpleExoPlayer player) |
Runs tasks of the main
Looper until the VideoListener.onRenderedFirstFrame()
callback has been called. |
static Timeline |
runUntilTimelineChanged(Player player) |
Runs tasks of the main
Looper until a timeline change occurred. |
static void |
runUntilTimelineChanged(Player player,
Timeline expectedTimeline) |
Runs tasks of the main
Looper until Player.getCurrentTimeline() matches the
expected timeline. |
public static void runUntilPlaybackState(Player player, @State int expectedState) throws TimeoutException
Looper
until Player.getPlaybackState()
matches the
expected state.player
- The Player
.expectedState
- The expected Player.State
.TimeoutException
- If the default timeout
is
exceeded.public static void runUntilPlayWhenReady(Player player, boolean expectedPlayWhenReady) throws TimeoutException
Looper
until Player.getPlayWhenReady()
matches the
expected value.player
- The Player
.expectedPlayWhenReady
- The expected value for Player.getPlayWhenReady()
.TimeoutException
- If the default timeout
is
exceeded.public static void runUntilTimelineChanged(Player player, Timeline expectedTimeline) throws TimeoutException
Looper
until Player.getCurrentTimeline()
matches the
expected timeline.player
- The Player
.expectedTimeline
- The expected Timeline
.TimeoutException
- If the default timeout
is
exceeded.public static Timeline runUntilTimelineChanged(Player player) throws TimeoutException
Looper
until a timeline change occurred.player
- The Player
.Timeline
.TimeoutException
- If the default timeout
is
exceeded.public static void runUntilPositionDiscontinuity(Player player, @DiscontinuityReason int expectedReason) throws TimeoutException
Looper
until a Player.EventListener.onPositionDiscontinuity(int)
callback with the specified Player.DiscontinuityReason
occurred.player
- The Player
.expectedReason
- The expected Player.DiscontinuityReason
.TimeoutException
- If the default timeout
is
exceeded.public static ExoPlaybackException runUntilError(Player player) throws TimeoutException
Looper
until a player error occurred.player
- The Player
.ExoPlaybackException
.TimeoutException
- If the default timeout
is
exceeded.public static boolean runUntilReceiveOffloadSchedulingEnabledNewState(Player player) throws TimeoutException
Looper
until a Player.EventListener.onExperimentalOffloadSchedulingEnabledChanged(boolean)
callback occurred.player
- The Player
.TimeoutException
- If the default timeout
is
exceeded.public static void runUntilRenderedFirstFrame(SimpleExoPlayer player) throws TimeoutException
Looper
until the VideoListener.onRenderedFirstFrame()
callback has been called.player
- The Player
.TimeoutException
- If the default timeout
is
exceeded.public static void playUntilPosition(ExoPlayer player, int windowIndex, long positionMs) throws TimeoutException
Player.play()
, runs tasks of the main Looper
until the player
reaches the specified position and then pauses the player
.player
- The Player
.windowIndex
- The window.positionMs
- The position within the window, in milliseconds.TimeoutException
- If the default timeout
is
exceeded.public static void playUntilStartOfWindow(ExoPlayer player, int windowIndex) throws TimeoutException
Player.play()
, runs tasks of the main Looper
until the player
reaches the specified window and then pauses the player
.player
- The Player
.windowIndex
- The window.TimeoutException
- If the default timeout
is
exceeded.public static void runUntilPendingCommandsAreFullyHandled(ExoPlayer player) throws TimeoutException
Looper
until the player completely handled all previously issued
commands on the internal playback thread.player
- The Player
.TimeoutException
- If the default timeout
is
exceeded.