public final class

TestPlayerRunHelper.ExoPlayerRunResult

extends TestPlayerRunHelper.PlayerRunResult

 java.lang.Object

androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult

↳androidx.media3.test.utils.robolectric.TestPlayerRunHelper.ExoPlayerRunResult

Overview

An ExoPlayer specific subclass of TestPlayerRunHelper.PlayerRunResult, giving access to conditions that only make sense for the ExoPlayer interface.

Summary

Fields
from TestPlayerRunHelper.PlayerRunResulthasBeenUsed, playBeforeWaiting
Methods
public TestPlayerRunHelper.PlayerRunResultignoringNonFatalErrors()

Returns a new instance where the untilXXX(...) methods ignore non-fatal errors.

public voiduntilBackgroundThreadCondition(<any> backgroundThreadCondition)

Runs tasks of the main until the specified condition becomes true independent of a message on the main .

public voiduntilPendingCommandsAreFullyHandled()

Runs tasks of the main until the player completely handled all previously issued commands on the internal playback thread.

public PlaybackExceptionuntilPlayerError()

Runs tasks of the main until a player error occurs.

public voiduntilPosition(int mediaItemIndex, long positionMs)

Runs tasks of the main until playback reaches the specified position or an error occurs.

public voiduntilSleepingForOffloadBecomes(boolean expectedSleepingForOffload)

Runs tasks of the main until ExoPlayer.isSleepingForOffload() matches the expected value, or an error occurs.

public voiduntilStartOfMediaItem(int mediaItemIndex)

Runs tasks of the main until playback reaches the specified media item or a playback error occurs.

from TestPlayerRunHelper.PlayerRunResultrunUntil, untilFirstFrameIsRendered, untilLoadingIs, untilPlayWhenReadyIs, untilPositionDiscontinuityWithReason, untilState, untilTimelineChanges, untilTimelineChangesTo
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public PlaybackException untilPlayerError()

Runs tasks of the main until a player error occurs.

Non-fatal errors are always ignored.

Returns:

The raised PlaybackException.

public void untilSleepingForOffloadBecomes(boolean expectedSleepingForOffload)

Runs tasks of the main until ExoPlayer.isSleepingForOffload() matches the expected value, or an error occurs.

public void untilPosition(int mediaItemIndex, long positionMs)

Runs tasks of the main until playback reaches the specified position or an error occurs.

The playback thread is automatically blocked from making further progress after reaching this position and will only be unblocked by other run()/play().untilXXX(...) method chains, custom RobolectricUtil.runMainLooperUntil() conditions, or an explicit ThreadTestUtil.unblockThreadsWaitingForProgressOnCurrentLooper() on the main thread.

public void untilStartOfMediaItem(int mediaItemIndex)

Runs tasks of the main until playback reaches the specified media item or a playback error occurs.

The playback thread is automatically blocked from making further progress after reaching the media item and will only be unblocked by other run()/play().untilXXX(...) method chains, custom RobolectricUtil.runMainLooperUntil() conditions, or an explicit ThreadTestUtil.unblockThreadsWaitingForProgressOnCurrentLooper() on the main thread.

Parameters:

mediaItemIndex: The index of the media item.

public void untilPendingCommandsAreFullyHandled()

Runs tasks of the main until the player completely handled all previously issued commands on the internal playback thread.

Both fatal and non-fatal errors are always ignored.

public void untilBackgroundThreadCondition(<any> backgroundThreadCondition)

Runs tasks of the main until the specified condition becomes true independent of a message on the main .

This method is useful for cases where the condition may change outside of a main message, for example because it's checking a volatile variable or shared synchronized state that is updated on a background thread, or because checking the condition itself may cause it to become true.

This method ensures the condition is checked within artificially created main messages. When using a FakeClock, this guarantees the remainder of the test method is not executed in parallel with other background thread messages.

Parameters:

backgroundThreadCondition: The condition to wait for.

public TestPlayerRunHelper.PlayerRunResult ignoringNonFatalErrors()

Returns a new instance where the untilXXX(...) methods ignore non-fatal errors.

A fatal error is defined as an error that is passed to and results in the player transitioning to Player.STATE_IDLE. A non-fatal error is defined as an error that is passed to any other callback (e.g. AnalyticsListener.onLoadError(AnalyticsListener.EventTime, LoadEventInfo, MediaLoadData, IOException, boolean)).