# TestPlayerRunHelper.CompositionPlayerRunResult

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

*** ** * ** ***


```
class TestPlayerRunHelper.CompositionPlayerRunResult : TestPlayerRunHelper.PlayerRunResult
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult) ||
|   | ↳ | [androidx.media3.test.utils.robolectric.TestPlayerRunHelper.CompositionPlayerRunResult](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult) |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/transformer/CompositionPlayer` specific subclass of `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult`, giving access to conditions that only make sense for `https://developer.android.com/reference/kotlin/androidx/media3/transformer/CompositionPlayer`.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#ignoringNonFatalErrors()()` Returns a new instance where the `untilXXX(...)` methods ignore non-fatal errors. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#untilBackgroundThreadCondition(com.google.common.base.Supplier<java.lang.Boolean>)( backgroundThreadCondition: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html!>! )` Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the specified condition becomes true independent of a message on the main `https://developer.android.com/reference/android/os/Looper.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#untilPendingCommandsAreFullyHandled()()` Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the player completely handled all previously issued commands on the internal playback thread. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#withTimeoutMs(long)(timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns a new instance where the `untilXXX(...)` methods use the given timeout. |

### Inherited functions

From [androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#runUntil(com.google.common.base.Supplier<java.lang.Boolean>)(predicate: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html!>!)`

Runs the main `https://developer.android.com/reference/android/os/Looper.html` until `predicate` returns true or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilAdCompleted(int,int)(adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, adIndexInAdGroup: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the specified ad finishes playing and transitions with `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#DISCONTINUITY_REASON_AUTO_TRANSITION()`, or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilAdGroupEnded(int)(adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until playback exits the specified `adGroupIndex` back to content (`newPosition.adGroupIndex == C.INDEX_UNSET`), or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilBackgroundThreadCondition(androidx.media3.common.util.Clock,com.google.common.base.Supplier<java.lang.Boolean>)(
clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!,
backgroundThreadCondition: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html!>!
)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the specified condition becomes true independent of a message on the main `https://developer.android.com/reference/android/os/Looper.html`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilFirstFrameIsRendered()()`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onRenderedFirstFrame()` is called or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilLoadingIs(boolean)(expectedIsLoading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isLoading()` matches the expected value or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPendingCommandsAreFullyHandled(androidx.media3.common.util.Clock,android.os.Looper)(clock: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Clock!, targetLooper: https://developer.android.com/reference/android/os/Looper.html!)`

Runs tasks of the `https://developer.android.com/reference/android/os/Looper.html#getMainLooper()` until all pending tasks in `targetLooper` have been handled and have propagated any updates to the main looper.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPlayWhenReadyIs(boolean)(expectedPlayWhenReady: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayWhenReady()` matches the expected value or an error occurs.
`https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPlayerError()()`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until a player error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPlayingAd(int,int)(adGroupIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, adIndexInAdGroup: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isPlayingAd()` is true for the specified `adGroupIndex` and `adIndexInAdGroup`, or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPlayingAdIs(boolean)(expectedIsPlayingAd: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isPlayingAd()` ()} matches the expected value or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilPositionDiscontinuityWithReason(int)(
@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason expectedReason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` is called with the specified `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason` or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilState(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State expectedState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackState()` matches the expected state or an error occurs.
`https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilTimelineChanges()()`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until a timeline change or an error occurs.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#untilTimelineChangesTo(androidx.media3.common.Timeline)(expectedTimeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!)`

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()` matches the expected timeline or an error occurs.

### Inherited properties

From [androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#hasBeenUsed()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#playBeforeWaiting()` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player!` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#player()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#throwNonFatalErrors()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.PlayerRunResult#timeoutMs()`

## Public functions

### ignoringNonFatalErrors

```
fun ignoringNonFatalErrors(): TestPlayerRunHelper.CompositionPlayerRunResult!
```

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

A fatal error is defined as an error that is passed to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)` and results in the player transitioning to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_IDLE()`. A non-fatal error is defined as an error that is passed to any other callback (e.g. `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/analytics/AnalyticsListener#onLoadError(androidx.media3.exoplayer.analytics.AnalyticsListener.EventTime,androidx.media3.exoplayer.source.LoadEventInfo,androidx.media3.exoplayer.source.MediaLoadData,java.io.IOException,boolean)`).

### untilBackgroundThreadCondition

```
fun untilBackgroundThreadCondition(
    backgroundThreadCondition: Supplier<Boolean!>!
): Unit
```

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the specified condition becomes true independent of a message on the main `https://developer.android.com/reference/android/os/Looper.html`.

This method is useful for cases where the condition may change outside of a main `https://developer.android.com/reference/android/os/Looper.html` 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 `https://developer.android.com/reference/android/os/Looper.html` messages. When using a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeClock`, this guarantees the remainder of the test method is not executed in parallel with other background thread messages.

| Parameters |
|---|---|
| `backgroundThreadCondition: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/base/Supplier.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html!>!` | The condition to wait for. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException` | If a playback error occurs. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If non-fatal playback errors occur, and aren't `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#ignoringNonFatalErrors()` (the non-fatal exceptions will be attached with `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)`). |
| `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` | If the timeout is exceeded. The timeout is `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RobolectricUtil#DEFAULT_TIMEOUT_MS()` by default, or a specific value if this instance is created via `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#withTimeoutMs(long)`. |

### untilPendingCommandsAreFullyHandled

```
fun untilPendingCommandsAreFullyHandled(): Unit
```

Runs tasks of the main `https://developer.android.com/reference/android/os/Looper.html` until the player completely handled all previously issued commands on the internal playback thread.

Both fatal and non-fatal errors are always ignored.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` | If the timeout is exceeded. The timeout is `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RobolectricUtil#DEFAULT_TIMEOUT_MS()` by default, or a specific value if this instance is created via `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/TestPlayerRunHelper.CompositionPlayerRunResult#withTimeoutMs(long)`. |

### withTimeoutMs

```
fun withTimeoutMs(timeoutMs: Long): TestPlayerRunHelper.CompositionPlayerRunResult!
```

Returns a new instance where the `untilXXX(...)` methods use the given timeout.

If not set, the default timeout is `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/robolectric/RobolectricUtil#DEFAULT_TIMEOUT_MS()`.

| Parameters |
|---|---|
| `timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timeout in milliseconds. |