# ExoPlayer.Builder

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

*** ** * ** ***


```
public final class ExoPlayer.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instances.

See `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context)` for the list of default values.

## Summary

| ### Constants |
|---|---|
| `static final long` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_DETACH_SURFACE_TIMEOUT_MS() = 2000` The default timeout for detaching a surface from the player, in milliseconds. |
| `static final long` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_RELEASE_TIMEOUT_MS() = 500` The default timeout for calls to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#release()` and `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)`, in milliseconds. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_BUFFERING_DETECTION_TIMEOUT_MS() = 600000` The default timeout for detecting whether playback is stuck buffering, in milliseconds. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_PLAYING_DETECTION_TIMEOUT_MS()` The default timeout for detecting whether playback is stuck playing, in milliseconds. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_PLAYING_NOT_ENDING_TIMEOUT_MS() = 60000` The default timeout for detecting whether playback is stuck playing but not ending, in milliseconds. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_SUPPRESSED_DETECTION_TIMEOUT_MS() = 600000` The default timeout for detecting whether playback is stuck in a suppressed state, in milliseconds. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context)` Creates a builder. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.source.MediaSource.Factory)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory)` Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.RenderersFactory)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory)` Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.RenderersFactory,androidx.media3.exoplayer.source.MediaSource.Factory)( https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory )` Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.RenderersFactory,androidx.media3.exoplayer.source.MediaSource.Factory,androidx.media3.exoplayer.trackselection.TrackSelector,androidx.media3.exoplayer.LoadControl,androidx.media3.exoplayer.upstream.BandwidthMeter,androidx.media3.exoplayer.analytics.AnalyticsCollector)( https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory, https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory, https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector trackSelector, https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl loadControl, https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter bandwidthMeter, https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector analyticsCollector )` Creates a builder with the specified custom components. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` | `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()()` Builds an `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instance. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/common/util/ExperimentalApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#experimentalSetForegroundModeTimeoutMs(long)(long timeoutMs)` Sets a limit on the time a call to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)` can spend. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setAnalyticsCollector(androidx.media3.exoplayer.analytics.AnalyticsCollector)(https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector analyticsCollector)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector` that will collect and forward all player events. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setAudioAttributes(androidx.media3.common.AudioAttributes,boolean)( https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes, boolean handleAudioFocus )` Sets `https://developer.android.com/reference/androidx/media3/common/AudioAttributes` that will be used by the player and whether to handle audio focus. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setAudioOutputProvider(androidx.media3.exoplayer.audio.AudioOutputProvider)(https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider audioOutputProvider)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider` that will be used to play out audio data. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setBandwidthMeter(androidx.media3.exoplayer.upstream.BandwidthMeter)(https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter bandwidthMeter)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/annotation/VisibleForTesting https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setClock(androidx.media3.common.util.Clock)(https://developer.android.com/reference/androidx/media3/common/util/Clock clock)` Sets the `https://developer.android.com/reference/androidx/media3/common/util/Clock` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setDetachSurfaceTimeoutMs(long)(long detachSurfaceTimeoutMs)` Sets a timeout for detaching a surface from the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setDeviceVolumeControlEnabled(boolean)(boolean deviceVolumeControlEnabled)` Sets whether the player is allowed to set, increase, decrease or mute device volume. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setEnforceAdPlaybackOnTimelineRefresh(boolean)( boolean enforceAdPlaybackOnTimelineRefresh )` Sets whether to enforce ad playback when the timeline is refreshed by a source update. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setHandleAudioBecomingNoisy(boolean)(boolean handleAudioBecomingNoisy)` Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setLivePlaybackSpeedControl(androidx.media3.exoplayer.LivePlaybackSpeedControl)( https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl livePlaybackSpeedControl )` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl` that will control the playback speed when playing live streams, in order to maintain a steady target offset from the live stream edge. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setLoadControl(androidx.media3.exoplayer.LoadControl)(https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl loadControl)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setLooper(android.os.Looper)(https://developer.android.com/reference/android/os/Looper.html looper)` Sets the `https://developer.android.com/reference/android/os/Looper.html` that must be used for all calls to the player and that is used to call listeners on. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setMaxSeekToPreviousPositionMs(long)( @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long maxSeekToPreviousPositionMs )` Sets the maximum position for which `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` seeks to the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setMediaSourceFactory(androidx.media3.exoplayer.source.MediaSource.Factory)(https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setName(java.lang.String)(https://developer.android.com/reference/java/lang/String.html playerName)` Sets the player name that is included in the `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` to recognize the player by its `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPauseAtEndOfMediaItems(boolean)(boolean pauseAtEndOfMediaItems)` Sets whether to pause playback at the end of each media item. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPlaybackLooper(android.os.Looper)(https://developer.android.com/reference/android/os/Looper.html playbackLooper)` Sets the `https://developer.android.com/reference/android/os/Looper.html` that will be used for playback. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPriority(int)(@https://developer.android.com/reference/androidx/media3/common/C.Priority int priority)` Sets the `https://developer.android.com/reference/androidx/media3/common/C.Priority` for this player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPriorityTaskManager(androidx.media3.common.PriorityTaskManager)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager priorityTaskManager )` Sets an `https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setReleaseTimeoutMs(long)(long releaseTimeoutMs)` Sets a timeout for calls to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#release()` and `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setRenderersFactory(androidx.media3.exoplayer.RenderersFactory)(https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setScrubbingModeParameters(androidx.media3.exoplayer.ScrubbingModeParameters)( https://developer.android.com/reference/androidx/media3/exoplayer/ScrubbingModeParameters scrubbingModeParameters )` Sets the parameters that control the behavior in `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setScrubbingModeEnabled(boolean)`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setSeekBackIncrementMs(long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs)` Sets the `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setSeekForwardIncrementMs(long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs)` Sets the `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setSeekParameters(androidx.media3.exoplayer.SeekParameters)(https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters seekParameters)` Sets the parameters that control how seek operations are performed. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setSkipSilenceEnabled(boolean)(boolean skipSilenceEnabled)` Sets whether silences silences in the audio stream is enabled. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setStuckBufferingDetectionTimeoutMs(int)( int stuckBufferingDetectionTimeoutMs )` Sets the timeout after which the player is assumed stuck buffering if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING()` and no loading progress is made, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setStuckPlayingDetectionTimeoutMs(int)(int stuckPlayingDetectionTimeoutMs)` Sets the timeout after which the player is assumed stuck playing if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()` and no playback progress is made, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setStuckPlayingNotEndingTimeoutMs(int)(int stuckPlayingNotEndingTimeoutMs)` Sets the timeout after which the player is assumed stuck playing if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()` and the playback is not ending despite exceeding the declared duration, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setStuckSuppressedDetectionTimeoutMs(int)( int stuckSuppressedDetectionTimeoutMs )` Sets the timeout after which the player is assumed stuck in a suppressed state if it has a `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` other than `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE()` or `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS()`, in milliseconds. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setSuppressPlaybackOnUnsuitableOutput(boolean)( boolean suppressPlaybackOnUnsuitableOutput )` Sets whether the player should suppress playback that is attempted on an unsuitable output. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setTrackSelector(androidx.media3.exoplayer.trackselection.TrackSelector)(https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector trackSelector)` Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setUseLazyPreparation(boolean)(boolean useLazyPreparation)` Sets whether media sources should be initialized lazily. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setUsePlatformDiagnostics(boolean)(boolean usePlatformDiagnostics)` Sets whether the player reports diagnostics data to the Android platform. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setVideoChangeFrameRateStrategy(int)( @https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy )` Sets a `https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy` that will be used by the player when provided with a video output `https://developer.android.com/reference/android/view/Surface.html`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html @https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setVideoScalingMode(int)(@https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode int videoScalingMode)` Sets the `https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode` that will be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setWakeMode(int)(@https://developer.android.com/reference/androidx/media3/common/C.WakeMode int wakeMode)` Sets the `https://developer.android.com/reference/androidx/media3/common/C.WakeMode` that will be used by the player. |

## Constants

### DEFAULT_DETACH_SURFACE_TIMEOUT_MS

```
@UnstableApi
public static final long DEFAULT_DETACH_SURFACE_TIMEOUT_MS = 2000
```

The default timeout for detaching a surface from the player, in milliseconds.

### DEFAULT_RELEASE_TIMEOUT_MS

```
@UnstableApi
public static final long DEFAULT_RELEASE_TIMEOUT_MS = 500
```

The default timeout for calls to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#release()` and `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)`, in milliseconds.

### DEFAULT_STUCK_BUFFERING_DETECTION_TIMEOUT_MS

```
@UnstableApi
public static final int DEFAULT_STUCK_BUFFERING_DETECTION_TIMEOUT_MS = 600000
```

The default timeout for detecting whether playback is stuck buffering, in milliseconds.

### DEFAULT_STUCK_PLAYING_DETECTION_TIMEOUT_MS

```
@UnstableApi
public static final int DEFAULT_STUCK_PLAYING_DETECTION_TIMEOUT_MS
```

The default timeout for detecting whether playback is stuck playing, in milliseconds.

### DEFAULT_STUCK_PLAYING_NOT_ENDING_TIMEOUT_MS

```
@UnstableApi
public static final int DEFAULT_STUCK_PLAYING_NOT_ENDING_TIMEOUT_MS = 60000
```

The default timeout for detecting whether playback is stuck playing but not ending, in milliseconds.

### DEFAULT_STUCK_SUPPRESSED_DETECTION_TIMEOUT_MS

```
@UnstableApi
public static final int DEFAULT_STUCK_SUPPRESSED_DETECTION_TIMEOUT_MS = 600000
```

The default timeout for detecting whether playback is stuck in a suppressed state, in milliseconds.

## Public constructors

### Builder

```
public Builder(Context context)
```

Creates a builder.

Use `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.RenderersFactory)`, `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.source.MediaSource.Factory)` or `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context,androidx.media3.exoplayer.RenderersFactory,androidx.media3.exoplayer.source.MediaSource.Factory)` instead, if you intend to provide a custom `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`, `https://developer.android.com/reference/androidx/media3/extractor/ExtractorsFactory` or `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory`. This is to ensure that ProGuard or R8 can remove ExoPlayer's `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultRenderersFactory`, `https://developer.android.com/reference/androidx/media3/extractor/DefaultExtractorsFactory` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory` from the APK.

The builder uses the following default values:

- `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`: `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultRenderersFactory`
- `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector`: `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/DefaultTrackSelector`
- `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`: `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory`
- `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl`: `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultLoadControl`
- `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter`: `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/DefaultBandwidthMeter#getSingletonInstance(android.content.Context)`
- `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl`: `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultLivePlaybackSpeedControl`
- `https://developer.android.com/reference/android/os/Looper.html`: The `https://developer.android.com/reference/android/os/Looper.html` associated with the current thread, or the `https://developer.android.com/reference/android/os/Looper.html` of the application's main thread if the current thread doesn't have a `https://developer.android.com/reference/android/os/Looper.html`
- `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector`: `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector` with `https://developer.android.com/reference/androidx/media3/common/util/Clock#DEFAULT()`
- `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider`: The `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider` configured by the `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`.
- `https://developer.android.com/reference/androidx/media3/common/C.Priority`: `https://developer.android.com/reference/androidx/media3/common/C#PRIORITY_PLAYBACK()`
- `https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager`: `null` (not used)
- `https://developer.android.com/reference/androidx/media3/common/AudioAttributes`: `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#DEFAULT()`, not handling audio focus
- `https://developer.android.com/reference/androidx/media3/common/C.WakeMode`: `https://developer.android.com/reference/androidx/media3/common/C#WAKE_MODE_LOCAL()`, or `https://developer.android.com/reference/androidx/media3/common/C#WAKE_MODE_NONE()` if any of the `stuck...DetectionTimeoutMs` values are set to `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`.
- `handleAudioBecomingNoisy`: `false`
- `suppressPlaybackOnUnsuitableOutput`: `false`
- `skipSilenceEnabled`: `false`
- `https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode`: `https://developer.android.com/reference/androidx/media3/common/C#VIDEO_SCALING_MODE_DEFAULT()`
- `https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy`: `https://developer.android.com/reference/androidx/media3/common/C#VIDEO_CHANGE_FRAME_RATE_STRATEGY_ONLY_IF_SEAMLESS()`
- `useLazyPreparation`: `true`
- `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters`: `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters#DEFAULT()`
- `seekBackIncrementMs`: `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_BACK_INCREMENT_MS()`
- `seekForwardIncrementMs`: `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_SEEK_FORWARD_INCREMENT_MS()`
- `maxSeekToPreviousPositionMs`: `https://developer.android.com/reference/androidx/media3/common/C#DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS()`
- `releaseTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_RELEASE_TIMEOUT_MS()`
- `detachSurfaceTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_DETACH_SURFACE_TIMEOUT_MS()`
- `stuckBufferingDetectionTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_BUFFERING_DETECTION_TIMEOUT_MS()`
- `stuckPlayingDetectionTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_PLAYING_DETECTION_TIMEOUT_MS()`
- `stuckPlayingNotEndingTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_PLAYING_NOT_ENDING_TIMEOUT_MS()`
- `stuckSuppressedDetectionTimeoutMs`: `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#DEFAULT_STUCK_SUPPRESSED_DETECTION_TIMEOUT_MS()`
- `pauseAtEndOfMediaItems`: `false`
- `usePlatformDiagnostics`: `true`
- `https://developer.android.com/reference/androidx/media3/common/util/Clock`: `https://developer.android.com/reference/androidx/media3/common/util/Clock#DEFAULT()`
- `playbackLooper`: `null` (create new thread)

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |

### Builder

```
@UnstableApi
public Builder(Context context, MediaSource.Factory mediaSourceFactory)
```

Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`.

See `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context)` for a list of default values.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory` (and therefore `https://developer.android.com/reference/androidx/media3/extractor/DefaultExtractorsFactory`) can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory` | A factory for creating a `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource` from a `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

### Builder

```
@UnstableApi
public Builder(Context context, RenderersFactory renderersFactory)
```

Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`.

See `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context)` for a list of default values.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultRenderersFactory` can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory` | A factory for creating `https://developer.android.com/reference/androidx/media3/exoplayer/Renderer` to be used by the player. |

### Builder

```
@UnstableApi
public Builder(
    Context context,
    RenderersFactory renderersFactory,
    MediaSource.Factory mediaSourceFactory
)
```

Creates a builder with a custom `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory` and `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`.

See `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#Builder(android.content.Context)` for a list of default values.

Note that this constructor is only useful to try and ensure that ExoPlayer's `https://developer.android.com/reference/androidx/media3/exoplayer/DefaultRenderersFactory`, `https://developer.android.com/reference/androidx/media3/exoplayer/source/DefaultMediaSourceFactory` (and therefore `https://developer.android.com/reference/androidx/media3/extractor/DefaultExtractorsFactory`) can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory` | A factory for creating `https://developer.android.com/reference/androidx/media3/exoplayer/Renderer` to be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory` | A factory for creating a `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource` from a `https://developer.android.com/reference/androidx/media3/common/MediaItem`. |

### Builder

```
@UnstableApi
public Builder(
    Context context,
    RenderersFactory renderersFactory,
    MediaSource.Factory mediaSourceFactory,
    TrackSelector trackSelector,
    LoadControl loadControl,
    BandwidthMeter bandwidthMeter,
    AnalyticsCollector analyticsCollector
)
```

Creates a builder with the specified custom components.

Note that this constructor is only useful to try and ensure that ExoPlayer's default components can be removed by ProGuard or R8.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory` | A factory for creating `https://developer.android.com/reference/androidx/media3/exoplayer/Renderer` to be used by the player. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory` | A `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector trackSelector` | A `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl loadControl` | A `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter bandwidthMeter` | A `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter`. |
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector analyticsCollector` | An `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector`. |

## Public methods

### build

```
public ExoPlayer build()
```

Builds an `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer` instance.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If this method has already been called. |

### experimentalSetForegroundModeTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
@ExperimentalApi
public ExoPlayer.Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs)
```

Sets a limit on the time a call to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)` can spend. If a call to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)` takes more than `timeoutMs` milliseconds to complete, the player will raise an error via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)`.

This method is experimental, and will be renamed or removed in a future release.

| Parameters |
|---|---|
| `long timeoutMs` | The time limit in milliseconds. |

### setAnalyticsCollector

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector` that will collect and forward all player events.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector analyticsCollector` | An `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/AnalyticsCollector`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setAudioAttributes

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setAudioAttributes(
    AudioAttributes audioAttributes,
    boolean handleAudioFocus
)
```

Sets `https://developer.android.com/reference/androidx/media3/common/AudioAttributes` that will be used by the player and whether to handle audio focus.

If audio focus should be handled, the `https://developer.android.com/reference/androidx/media3/common/AudioAttributes#usage()` must be `https://developer.android.com/reference/androidx/media3/common/C#USAGE_MEDIA()` or `https://developer.android.com/reference/androidx/media3/common/C#USAGE_GAME()`. Other usages will throw an `https://developer.android.com/reference/java/lang/IllegalArgumentException.html`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/AudioAttributes audioAttributes` | `https://developer.android.com/reference/androidx/media3/common/AudioAttributes`. |
| `boolean handleAudioFocus` | Whether the player should handle audio focus. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setAudioOutputProvider

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setAudioOutputProvider(AudioOutputProvider audioOutputProvider)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider` that will be used to play out audio data.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider audioOutputProvider` | An `https://developer.android.com/reference/androidx/media3/exoplayer/audio/AudioOutputProvider`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setBandwidthMeter

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setBandwidthMeter(BandwidthMeter bandwidthMeter)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter` that will be used by the player.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter bandwidthMeter` | A `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `bandwidthMeter` is `https://developer.android.com/reference/androidx/media3/exoplayer/upstream/BandwidthMeter#NO_OP()`. |

### setClock

```
@CanIgnoreReturnValue
@UnstableApi
@VisibleForTesting
public ExoPlayer.Builder setClock(Clock clock)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/util/Clock` that will be used by the player. Should only be set for testing purposes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/util/Clock clock` | A `https://developer.android.com/reference/androidx/media3/common/util/Clock`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setDetachSurfaceTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs)
```

Sets a timeout for detaching a surface from the player.

If detaching a surface or replacing a surface takes more than `
detachSurfaceTimeoutMs` to complete, the player will report an error via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)`.

| Parameters |
|---|---|
| `long detachSurfaceTimeoutMs` | The timeout for detaching a surface, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setDeviceVolumeControlEnabled

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setDeviceVolumeControlEnabled(boolean deviceVolumeControlEnabled)
```

Sets whether the player is allowed to set, increase, decrease or mute device volume.

| Parameters |
|---|---|
| `boolean deviceVolumeControlEnabled` | Whether controlling device volume is enabled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setEnforceAdPlaybackOnTimelineRefresh

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setEnforceAdPlaybackOnTimelineRefresh(
    boolean enforceAdPlaybackOnTimelineRefresh
)
```

Sets whether to enforce ad playback when the timeline is refreshed by a source update.

If `true`, then an ad group resolved at or before the current playback position during a timeline refresh will be played. If `false`, then the resolved ad group will not play.

The default is `true`.

| Parameters |
|---|---|
| `boolean enforceAdPlaybackOnTimelineRefresh` | Whether to enforce ad playback on timeline refresh. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setHandleAudioBecomingNoisy

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy)
```

Sets whether the player should pause automatically when audio is rerouted from a headset to device speakers. See the [audio becoming noisy](https://developer.android.com/media/platform/output#becoming-noisy) documentation for more information.

| Parameters |
|---|---|
| `boolean handleAudioBecomingNoisy` | Whether the player should pause automatically when audio is rerouted from a headset to device speakers. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setLivePlaybackSpeedControl

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setLivePlaybackSpeedControl(
    LivePlaybackSpeedControl livePlaybackSpeedControl
)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl` that will control the playback speed when playing live streams, in order to maintain a steady target offset from the live stream edge.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl livePlaybackSpeedControl` | The `https://developer.android.com/reference/androidx/media3/exoplayer/LivePlaybackSpeedControl`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setLoadControl

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setLoadControl(LoadControl loadControl)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl` that will be used by the player.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl loadControl` | A `https://developer.android.com/reference/androidx/media3/exoplayer/LoadControl`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setLooper

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setLooper(Looper looper)
```

Sets the `https://developer.android.com/reference/android/os/Looper.html` that must be used for all calls to the player and that is used to call listeners on.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/os/Looper.html looper` | A `https://developer.android.com/reference/android/os/Looper.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setMaxSeekToPreviousPositionMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setMaxSeekToPreviousPositionMs(
    @IntRange(from = 0) long maxSeekToPreviousPositionMs
)
```

Sets the maximum position for which `https://developer.android.com/reference/androidx/media3/common/Player#seekToPrevious()` seeks to the previous `https://developer.android.com/reference/androidx/media3/common/MediaItem`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long maxSeekToPreviousPositionMs` | The maximum position, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `maxSeekToPreviousPositionMs` is negative. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setMediaSourceFactory

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory` that will be used by the player.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory mediaSourceFactory` | A `https://developer.android.com/reference/androidx/media3/exoplayer/source/MediaSource.Factory`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setName

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setName(String playerName)
```

Sets the player name that is included in the `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId` to recognize the player by its `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId`.

This must not be equal to the `name` of `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#PRELOAD()` ("preload").

The default is an empty string.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html playerName` | A name for the player in the `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the passed `playerName` is equal to the ` name` of `https://developer.android.com/reference/androidx/media3/exoplayer/analytics/PlayerId#PRELOAD()` ("preload"). |

### setPauseAtEndOfMediaItems

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems)
```

Sets whether to pause playback at the end of each media item.

This means the player will pause at the end of each window in the current `https://developer.android.com/reference/androidx/media3/common/Player#getCurrentTimeline()`. Listeners will be informed by a call to `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayWhenReadyChanged(boolean,int)` with the reason `https://developer.android.com/reference/androidx/media3/common/Player#PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM()` when this happens.

| Parameters |
|---|---|
| `boolean pauseAtEndOfMediaItems` | Whether to pause playback at the end of each media item. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setPlaybackLooper

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setPlaybackLooper(Looper playbackLooper)
```

Sets the `https://developer.android.com/reference/android/os/Looper.html` that will be used for playback.

The backing thread should run with priority `https://developer.android.com/reference/android/os/Process.html#THREAD_PRIORITY_AUDIO` and should handle messages within 10ms.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/os/Looper.html playbackLooper` | A `https://developer.android.com/reference/android/os/Looper.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called, or when the `https://developer.android.com/reference/android/os/Looper.html#getMainLooper()` is passed in. |

### setPriority

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setPriority(@C.Priority int priority)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/C.Priority` for this player.

The priority may influence resource allocation between multiple players or other components running in the same app.

This priority is used for the `https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager`, if `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPriorityTaskManager(androidx.media3.common.PriorityTaskManager)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.Priority int priority` | The `https://developer.android.com/reference/androidx/media3/common/C.Priority`. |

### setPriorityTaskManager

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setPriorityTaskManager(
    @Nullable PriorityTaskManager priorityTaskManager
)
```

Sets an `https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager` that will be used by the player.

The priority set via `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setPriority(int)` (or `https://developer.android.com/reference/androidx/media3/common/C#PRIORITY_PLAYBACK()` will be set while the player is loading.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager priorityTaskManager` | A `https://developer.android.com/reference/androidx/media3/common/PriorityTaskManager`, or null to not use one. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setReleaseTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setReleaseTimeoutMs(long releaseTimeoutMs)
```

Sets a timeout for calls to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#release()` and `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)`.

If a call to `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#release()` or `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setForegroundMode(boolean)` takes more than `
timeoutMs` to complete, the player will report an error via `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlayerError(androidx.media3.common.PlaybackException)`.

| Parameters |
|---|---|
| `long releaseTimeoutMs` | The release timeout, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setRenderersFactory

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setRenderersFactory(RenderersFactory renderersFactory)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory` that will be used by the player.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory renderersFactory` | A `https://developer.android.com/reference/androidx/media3/exoplayer/RenderersFactory`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setScrubbingModeParameters

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setScrubbingModeParameters(
    ScrubbingModeParameters scrubbingModeParameters
)
```

Sets the parameters that control the behavior in `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer#setScrubbingModeEnabled(boolean)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ScrubbingModeParameters scrubbingModeParameters` | The `https://developer.android.com/reference/androidx/media3/exoplayer/ScrubbingModeParameters`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setSeekBackIncrementMs

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/Player#seekBack()` increment.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekBackIncrementMs` | The seek back increment, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `seekBackIncrementMs` is non-positive. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setSeekForwardIncrementMs

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/Player#seekForward()` increment.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 1) long seekForwardIncrementMs` | The seek forward increment, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `seekForwardIncrementMs` is non-positive. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setSeekParameters

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setSeekParameters(SeekParameters seekParameters)
```

Sets the parameters that control how seek operations are performed.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters seekParameters` | The `https://developer.android.com/reference/androidx/media3/exoplayer/SeekParameters`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setSkipSilenceEnabled

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setSkipSilenceEnabled(boolean skipSilenceEnabled)
```

Sets whether silences silences in the audio stream is enabled.

| Parameters |
|---|---|
| `boolean skipSilenceEnabled` | Whether skipping silences is enabled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setStuckBufferingDetectionTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setStuckBufferingDetectionTimeoutMs(
    int stuckBufferingDetectionTimeoutMs
)
```

Sets the timeout after which the player is assumed stuck buffering if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING()` and no loading progress is made, in milliseconds.

If this timeout is triggered, the player will transition to an error state with a `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException` using `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException#STUCK_BUFFERING_NO_PROGRESS()`.

| Parameters |
|---|---|
| `int stuckBufferingDetectionTimeoutMs` | The timeout after which the player is assumed stuck buffering, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setStuckPlayingDetectionTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setStuckPlayingDetectionTimeoutMs(int stuckPlayingDetectionTimeoutMs)
```

Sets the timeout after which the player is assumed stuck playing if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()` and no playback progress is made, in milliseconds.

If this timeout is triggered, the player will transition to an error state with a `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException` using `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException#STUCK_PLAYING_NO_PROGRESS()`.

| Parameters |
|---|---|
| `int stuckPlayingDetectionTimeoutMs` | The timeout after which the player is assumed stuck playing, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setStuckPlayingNotEndingTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setStuckPlayingNotEndingTimeoutMs(int stuckPlayingNotEndingTimeoutMs)
```

Sets the timeout after which the player is assumed stuck playing if it's in `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()` and the playback is not ending despite exceeding the declared duration, in milliseconds.

If this timeout is triggered, the player will transition to an error state with a `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException` using `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException#STUCK_PLAYING_NOT_ENDING()`.

| Parameters |
|---|---|
| `int stuckPlayingNotEndingTimeoutMs` | The timeout after which the player is assumed stuck playing and not ending, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setStuckSuppressedDetectionTimeoutMs

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setStuckSuppressedDetectionTimeoutMs(
    int stuckSuppressedDetectionTimeoutMs
)
```

Sets the timeout after which the player is assumed stuck in a suppressed state if it has a `https://developer.android.com/reference/androidx/media3/common/Player#getPlaybackSuppressionReason()` other than `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_NONE()` or `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS()`, in milliseconds.

If this timeout is triggered, the player will transition to an error state with a `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException` using `https://developer.android.com/reference/androidx/media3/common/util/StuckPlayerException#STUCK_SUPPRESSED()`.

| Parameters |
|---|---|
| `int stuckSuppressedDetectionTimeoutMs` | The timeout after which the player is assumed stuck in a suppressed state, in milliseconds. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setSuppressPlaybackOnUnsuitableOutput

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setSuppressPlaybackOnUnsuitableOutput(
    boolean suppressPlaybackOnUnsuitableOutput
)
```

Sets whether the player should suppress playback that is attempted on an unsuitable output. An example of an unsuitable audio output is the built-in speaker on a Wear OS device (unless it is explicitly selected by the user).

If called with `suppressPlaybackOnUnsuitableOutput = true`, then a playback attempt on an unsuitable audio output will result in calls to `https://developer.android.com/reference/androidx/media3/common/Player.Listener#onPlaybackSuppressionReasonChanged(int)` with the value `https://developer.android.com/reference/androidx/media3/common/Player#PLAYBACK_SUPPRESSION_REASON_UNSUITABLE_AUDIO_OUTPUT()`.

Callers of this may also want to enable `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#setHandleAudioBecomingNoisy(boolean)` to prevent playback from continuing on the built-in speaker when a headset is disconnected.

| Parameters |
|---|---|
| `boolean suppressPlaybackOnUnsuitableOutput` | Whether the player should suppress the playback when it is attempted on an unsuitable output. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setTrackSelector

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setTrackSelector(TrackSelector trackSelector)
```

Sets the `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector` that will be used by the player.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector trackSelector` | A `https://developer.android.com/reference/androidx/media3/exoplayer/trackselection/TrackSelector`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setUseLazyPreparation

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setUseLazyPreparation(boolean useLazyPreparation)
```

Sets whether media sources should be initialized lazily.

If false, all initial preparation steps (e.g., manifest loads) happen immediately. If true, these initial preparations are triggered only when the player starts buffering the media.

| Parameters |
|---|---|
| `boolean useLazyPreparation` | Whether to use lazy preparation. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setUsePlatformDiagnostics

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setUsePlatformDiagnostics(boolean usePlatformDiagnostics)
```

Sets whether the player reports diagnostics data to the Android platform.

If enabled, the player will use the `https://developer.android.com/reference/android/media/metrics/MediaMetricsManager.html` to create a `https://developer.android.com/reference/android/media/metrics/PlaybackSession.html` and forward playback events and performance data to this session. This helps to provide system performance and debugging information for media playback on the device. This data may also be collected by Google [if sharing usage and diagnostics data is enabled](https://support.google.com/accounts/answer/6078260) by the user of the device.

| Parameters |
|---|---|
| `boolean usePlatformDiagnostics` | Whether the player reports diagnostics data to the Android platform. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setVideoChangeFrameRateStrategy

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setVideoChangeFrameRateStrategy(
    @C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy
)
```

Sets a `https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy` that will be used by the player when provided with a video output `https://developer.android.com/reference/android/view/Surface.html`.

The strategy only applies if a `https://developer.android.com/reference/android/media/MediaCodec.html`-based video `https://developer.android.com/reference/androidx/media3/exoplayer/Renderer` is enabled. Applications wishing to use `https://developer.android.com/reference/android/view/Surface.html#CHANGE_FRAME_RATE_ALWAYS` should set the mode to `https://developer.android.com/reference/androidx/media3/common/C#VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF()` to disable calls to `https://developer.android.com/reference/android/view/Surface.html#setFrameRate(float, int)` from ExoPlayer, and should then call `https://developer.android.com/reference/android/view/Surface.html#setFrameRate(float, int)` directly from application code.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy` | A `https://developer.android.com/reference/androidx/media3/common/C.VideoChangeFrameRateStrategy`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setVideoScalingMode

```
@CanIgnoreReturnValue
@UnstableApi
public ExoPlayer.Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode` that will be used by the player.

The scaling mode only applies if a `https://developer.android.com/reference/android/media/MediaCodec.html`-based video `https://developer.android.com/reference/androidx/media3/exoplayer/Renderer` is enabled and if the output surface is owned by a `https://developer.android.com/reference/android/view/SurfaceView.html`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode int videoScalingMode` | A `https://developer.android.com/reference/androidx/media3/common/C.VideoScalingMode`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |

### setWakeMode

```
@CanIgnoreReturnValue
public ExoPlayer.Builder setWakeMode(@C.WakeMode int wakeMode)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/C.WakeMode` that will be used by the player.

`https://developer.android.com/reference/androidx/media3/common/C#WAKE_MODE_LOCAL()` should be used together with a foreground `https://developer.android.com/reference/android/app/Service.html` for use cases where playback occurs and the screen is off (e.g. background audio playback).

`https://developer.android.com/reference/androidx/media3/common/C#WAKE_MODE_NETWORK()` is only required for uses cases requiring low-latency Wifi access during screen on playback, or to work around some Wifi stability issues on older devices while the screen is off.

When enabled, the locks (`https://developer.android.com/reference/android/os/PowerManager.WakeLock.html` / `https://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html`) will be held whenever the player is in the `https://developer.android.com/reference/androidx/media3/common/Player#STATE_READY()` or `https://developer.android.com/reference/androidx/media3/common/Player#STATE_BUFFERING()` states with `playWhenReady = true`. The locks held depend on the specified `https://developer.android.com/reference/androidx/media3/common/C.WakeMode`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/C.WakeMode int wakeMode` | A `https://developer.android.com/reference/androidx/media3/common/C.WakeMode`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer.Builder#build()` has already been called. |