# ExoPlayerTestRunner

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

*** ** * ** ***


```
@UnstableApi
class ExoPlayerTestRunner : Player.Listener, ActionSchedule.Callback
```

<br />

*** ** * ** ***

Helper class to run an ExoPlayer test.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner.Builder` Builder to set-up an `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner`. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#AUDIO_FORMAT()` A generic audio `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` which can be used to set up a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource`. |
| `const https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#VIDEO_FORMAT()` A generic video `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` which can be used to set up a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertNoPositionDiscontinuities()()` Asserts that `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` was not called. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertPlaybackStatesEqual(java.lang.Integer...)(states: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!)` Asserts that the playback states reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` are equal to the provided playback states. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertPlayedPeriodIndices(java.lang.Integer...)(periodIndices: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!)` Asserts that the indices of played periods is equal to the provided list of periods. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertPositionDiscontinuityReasonsEqual(java.lang.Integer...)( discontinuityReasons: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>! )` Asserts that the discontinuity reasons reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` are equal to the provided values. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertTimelineChangeReasonsEqual(java.lang.Integer...)(reasons: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!)` Asserts that the timeline change reasons reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` are equal to the provided timeline change reasons. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#assertTimelinesSame(androidx.media3.common.Timeline...)(timelines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!>!)` Asserts that the timelines reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` are the same to the provided timelines. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#blockUntilActionScheduleFinished(long)(timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Blocks the current thread until the action schedule finished. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#blockUntilEnded(long)(timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Blocks the current thread until the test runner finishes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onActionScheduleFinished()()` Called when action schedule finished executing all its actions. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onMediaItemTransition(androidx.media3.common.MediaItem,int)( mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem?, @https://developer.android.com/reference/kotlin/androidx/media3/common/Player.MediaItemTransitionReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Called when playback transitions to a media item or starts repeating a media item according to the current `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onPlaybackStateChanged(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State playbackState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackState()` changes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onPlayerError(androidx.media3.common.PlaybackException)(error: https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException!)` Called when an error occurs. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)( oldPosition: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo!, newPosition: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo!, @https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Called when a position discontinuity occurs. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#onTimelineChanged(androidx.media3.common.Timeline,int)( timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!, @https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()` changes. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#start()()` Starts the test runner on its own thread. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#start(boolean)(doPrepare: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Starts the test runner on its own thread. |

### Inherited functions

From [androidx.media3.common.Player.Listener](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAudioAttributesChanged(androidx.media3.common.AudioAttributes)(audioAttributes: https://developer.android.com/reference/kotlin/androidx/media3/common/AudioAttributes!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getAudioAttributes()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAudioSessionIdChanged(int)(audioSessionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Called when the audio session ID changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onAvailableCommandsChanged(androidx.media3.common.Player.Commands)(availableCommands: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Commands!)`

Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isCommandAvailable(int)` changes for at least one `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Command`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)(cueGroup: https://developer.android.com/reference/kotlin/androidx/media3/common/text/CueGroup!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentCues()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
[onCues](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(java.util.List<androidx.media3.common.text.Cue>))(cues: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/text/Cue!>!)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onCues(androidx.media3.common.text.CueGroup)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onDeviceInfoChanged(androidx.media3.common.DeviceInfo)(deviceInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/DeviceInfo!)`

Called when the device information changes
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onDeviceVolumeChanged(int,boolean)(volume: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, muted: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getDeviceVolume()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isDeviceMuted()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)(player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player!, events: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Events!)`

Called when one or more player states changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)(isLoading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the player starts or stops loading the source.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsPlayingChanged(boolean)(isPlaying: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#isPlaying()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
[onLoadingChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onLoadingChanged(boolean))(isLoading: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onIsLoadingChanged(boolean)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMaxSeekToPreviousPositionChanged(long)(maxSeekToPreviousPositionMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMaxSeekToPreviousPosition()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMediaMetadataChanged(androidx.media3.common.MediaMetadata)(mediaMetadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getMediaMetadata()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onMetadata(androidx.media3.common.Metadata)(metadata: https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata!)`

Called when there is metadata associated with the current playback time.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)(
playWhenReady: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html,
@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlayWhenReadyChangeReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayWhenReady()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackParametersChanged(androidx.media3.common.PlaybackParameters)(playbackParameters: https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackParameters!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackParameters()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackSuppressionReasonChanged(int)(
@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PlaybackSuppressionReason playbackSuppressionReason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackSuppressionReason()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerErrorChanged(androidx.media3.common.PlaybackException)(error: https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException?)`

Called when the `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException` returned by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlayerError()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
[onPlayerStateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayerStateChanged(boolean,int))(
playWhenReady: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html,
@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State playbackState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` and `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaylistMetadataChanged(androidx.media3.common.MediaMetadata)(mediaMetadata: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaMetadata!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaylistMetadata()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi
[onPositionDiscontinuity](https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(int))(@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.**

Use `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` instead.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onRenderedFirstFrame()()`

Called when a frame is rendered for the first time since setting the surface, or since the renderer was reset, or since the stream being rendered was changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onRepeatModeChanged(int)(@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.RepeatMode repeatMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSeekBackIncrementChanged(long)(seekBackIncrementMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekBackIncrement()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSeekForwardIncrementChanged(long)(seekForwardIncrementMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getSeekForwardIncrement()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onShuffleModeEnabledChanged(boolean)(shuffleModeEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getShuffleModeEnabled()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSkipSilenceEnabledChanged(boolean)(skipSilenceEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Called when skipping silences is enabled or disabled in the audio stream.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onSurfaceSizeChanged(int,int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Called each time there's a change in the size of the surface onto which the video is being rendered.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTrackSelectionParametersChanged(androidx.media3.common.TrackSelectionParameters)(parameters: https://developer.android.com/reference/kotlin/androidx/media3/common/TrackSelectionParameters!)`

Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getTrackSelectionParameters()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTracksChanged(androidx.media3.common.Tracks)(tracks: https://developer.android.com/reference/kotlin/androidx/media3/common/Tracks!)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTracks()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onVideoSizeChanged(androidx.media3.common.VideoSize)(videoSize: https://developer.android.com/reference/kotlin/androidx/media3/common/VideoSize!)`

Called each time when `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVideoSize()` changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onVolumeChanged(float)(volume: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getVolume()` changes.

## Constants

### AUDIO_FORMAT

```
const val AUDIO_FORMAT: Format!
```

A generic audio `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` which can be used to set up a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource`.

### VIDEO_FORMAT

```
const val VIDEO_FORMAT: Format!
```

A generic video `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` which can be used to set up a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeMediaSource`.

## Public functions

### assertNoPositionDiscontinuities

```
fun assertNoPositionDiscontinuities(): Unit
```

Asserts that `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` was not called.

### assertPlaybackStatesEqual

```
fun assertPlaybackStatesEqual(states: Array<Int!>!): Unit
```

Asserts that the playback states reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPlaybackStateChanged(int)` are equal to the provided playback states.

### assertPlayedPeriodIndices

```
fun assertPlayedPeriodIndices(periodIndices: Array<Int!>!): Unit
```

Asserts that the indices of played periods is equal to the provided list of periods. A period is considered to be played if it was the current period after a position discontinuity or a media source preparation. When the same period is repeated automatically due to enabled repeat modes, it is reported twice. Seeks within the current period are not reported.

| Parameters |
|---|---|
| `periodIndices: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!` | A list of expected period indices. |

### assertPositionDiscontinuityReasonsEqual

```
fun assertPositionDiscontinuityReasonsEqual(
    discontinuityReasons: Array<Int!>!
): Unit
```

Asserts that the discontinuity reasons reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` are equal to the provided values.

| Parameters |
|---|---|
| `discontinuityReasons: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!` | The expected discontinuity reasons. |

### assertTimelineChangeReasonsEqual

```
fun assertTimelineChangeReasonsEqual(reasons: Array<Int!>!): Unit
```

Asserts that the timeline change reasons reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` are equal to the provided timeline change reasons.

### assertTimelinesSame

```
fun assertTimelinesSame(timelines: Array<Timeline!>!): Unit
```

Asserts that the timelines reported by `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onTimelineChanged(androidx.media3.common.Timeline,int)` are the same to the provided timelines. This assert differs from testing equality by not comparing period ids which may be different due to id mapping of child source period ids.

| Parameters |
|---|---|
| `timelines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!>!` | A list of expected `https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline`s. |

### blockUntilActionScheduleFinished

```
@CanIgnoreReturnValue
fun blockUntilActionScheduleFinished(timeoutMs: Long): ExoPlayerTestRunner!
```

Blocks the current thread until the action schedule finished. This does not release the test runner and the test must still call `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner#blockUntilEnded(long)`.

| Parameters |
|---|---|
| `timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum time to wait for the action schedule to finish. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | This test runner. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html` | If the action schedule did not finish within the specified timeout. |
| `https://developer.android.com/reference/java/lang/InterruptedException.html` | If the test thread gets interrupted while waiting. |

### blockUntilEnded

```
@CanIgnoreReturnValue
fun blockUntilEnded(timeoutMs: Long): ExoPlayerTestRunner!
```

Blocks the current thread until the test runner finishes. A test is deemed to be finished when the playback state transitioned to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_ENDED()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_IDLE()` for the specified number of times. The test also finishes when an `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlaybackException` is thrown.

| Parameters |
|---|---|
| `timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The maximum time to wait for the test runner to finish. If this time elapsed the method will throw a `https://developer.android.com/reference/java/util/concurrent/TimeoutException.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | This test runner. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Exception.html` | If any exception occurred during playback, release, or due to a timeout. |

### onActionScheduleFinished

```
fun onActionScheduleFinished(): Unit
```

Called when action schedule finished executing all its actions.

### onMediaItemTransition

```
fun onMediaItemTransition(
    mediaItem: MediaItem?,
    @Player.MediaItemTransitionReason reason: Int
): Unit
```

Called when playback transitions to a media item or starts repeating a media item according to the current `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getRepeatMode()`.

Note that this callback is also called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()` becomes non-empty or empty.

`https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `mediaItem: https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem`. May be null if the playlist becomes empty. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.MediaItemTransitionReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The reason for the transition. |

### onPlaybackStateChanged

```
fun onPlaybackStateChanged(@Player.State playbackState: Int): Unit
```

Called when the value returned from `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getPlaybackState()` changes.

`https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State playbackState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The new playback `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.State`. |

### onPlayerError

```
fun onPlayerError(error: PlaybackException!): Unit
```

Called when an error occurs. The playback state will transition to `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#STATE_IDLE()` immediately after this method is called. The player instance can still be used, and `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#release()` must still be called on the player should it no longer be required.

`https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

Implementations of Player may pass an instance of a subclass of `https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException` to this method in order to include more information about the error.

| Parameters |
|---|---|
| `error: https://developer.android.com/reference/kotlin/androidx/media3/common/PlaybackException!` | The error. |

### onPositionDiscontinuity

```
fun onPositionDiscontinuity(
    oldPosition: Player.PositionInfo!,
    newPosition: Player.PositionInfo!,
    @Player.DiscontinuityReason reason: Int
): Unit
```

Called when a position discontinuity occurs.

A position discontinuity occurs when the playing period changes, the playback position jumps within the period currently being played, or when the playing period has been skipped or removed.

`https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `oldPosition: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo!` | The position before the discontinuity. |
| `newPosition: https://developer.android.com/reference/kotlin/androidx/media3/common/Player.PositionInfo!` | The position after the discontinuity. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.DiscontinuityReason` responsible for the discontinuity. |

### onTimelineChanged

```
fun onTimelineChanged(
    timeline: Timeline!,
    @Player.TimelineChangeReason reason: Int
): Unit
```

Called when the value of `https://developer.android.com/reference/kotlin/androidx/media3/common/Player#getCurrentTimeline()` changes.

Note that the current `https://developer.android.com/reference/kotlin/androidx/media3/common/MediaItem` or playback position may change as a result of a timeline change. If playback can't continue smoothly because of this timeline change, a separate `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onPositionDiscontinuity(androidx.media3.common.Player.PositionInfo,androidx.media3.common.Player.PositionInfo,int)` callback will be triggered.

`https://developer.android.com/reference/kotlin/androidx/media3/common/Player.Listener#onEvents(androidx.media3.common.Player,androidx.media3.common.Player.Events)` will also be called to report this event along with other events that happen in the same `https://developer.android.com/reference/android/os/Looper.html` message queue iteration.

| Parameters |
|---|---|
| `timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!` | The latest timeline. Never null, but may be empty. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player.TimelineChangeReason` responsible for this timeline change. |

### start

```
@CanIgnoreReturnValue
fun start(): ExoPlayerTestRunner!
```

Starts the test runner on its own thread. This will trigger the creation of the player, the listener registration, the start of the action schedule, the initial set of media items and the preparation of the player.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | This test runner. |

### start

```
@CanIgnoreReturnValue
fun start(doPrepare: Boolean): ExoPlayerTestRunner!
```

Starts the test runner on its own thread. This will trigger the creation of the player, the listener registration, the start of the action schedule and the initial set of media items.

| Parameters |
|---|---|
| `doPrepare: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the player should be prepared. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ExoPlayerTestRunner!` | This test runner. |