Package com.google.android.exoplayer2

## Class ExoPlayer.Builder

- java.lang.Object
- - com.google.android.exoplayer2.ExoPlayer.Builder

- Enclosing interface:
    ExoPlayer

      @Deprecated
      public static final class ExoPlayer.Builder
      extends Object

  Deprecated.
  Use `SimpleExoPlayer.Builder` instead.
  A builder for `ExoPlayer` instances.

  See `Builder(Context, Renderer...)` for the list of default values.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder​(Context context, Renderer... renderers)` | Deprecated. Creates a builder with a list of `Renderers`.
    `Builder​(Renderer[] renderers, TrackSelector trackSelector, MediaSourceFactory mediaSourceFactory, LoadControl loadControl, BandwidthMeter bandwidthMeter)` | Deprecated. Creates a builder with the specified custom components.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ExoPlayer` | `build()` | Deprecated. Builds an `ExoPlayer` instance.
    `ExoPlayer.Builder` | `experimentalSetForegroundModeTimeoutMs​(long timeoutMs)` | Deprecated. Set a limit on the time a call to `ExoPlayer.setForegroundMode(boolean)` can spend.
    `ExoPlayer.Builder` | `setAnalyticsCollector​(AnalyticsCollector analyticsCollector)` | Deprecated. Sets the `AnalyticsCollector` that will collect and forward all player events.
    `ExoPlayer.Builder` | `setBandwidthMeter​(BandwidthMeter bandwidthMeter)` | Deprecated. Sets the `BandwidthMeter` that will be used by the player.
    `ExoPlayer.Builder` | `setClock​(Clock clock)` | Deprecated. Sets the `Clock` that will be used by the player.
    `ExoPlayer.Builder` | `setLivePlaybackSpeedControl​(LivePlaybackSpeedControl livePlaybackSpeedControl)` | Deprecated. Sets the `LivePlaybackSpeedControl` that will control the playback speed when playing live streams, in order to maintain a steady target offset from the live stream edge.
    `ExoPlayer.Builder` | `setLoadControl​(LoadControl loadControl)` | Deprecated. Sets the `LoadControl` that will be used by the player.
    `ExoPlayer.Builder` | `setLooper​(Looper looper)` | Deprecated. Sets the `Looper` that must be used for all calls to the player and that is used to call listeners on.
    `ExoPlayer.Builder` | `setMediaSourceFactory​(MediaSourceFactory mediaSourceFactory)` | Deprecated. Sets the `MediaSourceFactory` that will be used by the player.
    `ExoPlayer.Builder` | `setPauseAtEndOfMediaItems​(boolean pauseAtEndOfMediaItems)` | Deprecated. Sets whether to pause playback at the end of each media item.
    `ExoPlayer.Builder` | `setReleaseTimeoutMs​(long releaseTimeoutMs)` | Deprecated. Sets a timeout for calls to `Player.release()` and `ExoPlayer.setForegroundMode(boolean)`.
    `ExoPlayer.Builder` | `setSeekParameters​(SeekParameters seekParameters)` | Deprecated. Sets the parameters that control how seek operations are performed.
    `ExoPlayer.Builder` | `setTrackSelector​(TrackSelector trackSelector)` | Deprecated. Sets the `TrackSelector` that will be used by the player.
    `ExoPlayer.Builder` | `setUseLazyPreparation​(boolean useLazyPreparation)` | Deprecated. Sets whether media sources should be initialized lazily.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder​(Context context,
                         Renderer... renderers)

      Deprecated.
      Creates a builder with a list of `Renderers`.

      The builder uses the following default values:

      - `TrackSelector`: `DefaultTrackSelector`
      - `MediaSourceFactory`: `DefaultMediaSourceFactory`
      - `LoadControl`: `DefaultLoadControl`
      - `BandwidthMeter`: `DefaultBandwidthMeter.getSingletonInstance(Context)`
      - `LivePlaybackSpeedControl`: `DefaultLivePlaybackSpeedControl`
      - `Looper`: The `Looper` associated with the current thread, or the `Looper` of the application's main thread if the current thread doesn't have a `Looper`
      - `AnalyticsCollector`: `AnalyticsCollector` with `Clock.DEFAULT`
      - `useLazyPreparation`: `true`
      - `SeekParameters`: `SeekParameters.DEFAULT`
      - `releaseTimeoutMs`: `ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MS`
      - `pauseAtEndOfMediaItems`: `false`
      - `Clock`: `Clock.DEFAULT`
      Parameters:
        `context` - A `Context`.
        `renderers` - The `Renderers` to be used by the player.

    - #### Builder

          public Builder​(Renderer[] renderers,
                         TrackSelector trackSelector,
                         MediaSourceFactory mediaSourceFactory,
                         LoadControl loadControl,
                         BandwidthMeter bandwidthMeter)

      Deprecated.
      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:
        `renderers` - The `Renderers` to be used by the player.
        `trackSelector` - A `TrackSelector`.
        `mediaSourceFactory` - A `MediaSourceFactory`.
        `loadControl` - A `LoadControl`.
        `bandwidthMeter` - A `BandwidthMeter`.

  - ### Method Detail

    - #### experimentalSetForegroundModeTimeoutMs

          public ExoPlayer.Builder experimentalSetForegroundModeTimeoutMs​(long timeoutMs)

      Deprecated.
      Set a limit on the time a call to `ExoPlayer.setForegroundMode(boolean)` can spend. If a call to `ExoPlayer.setForegroundMode(boolean)` takes more than `timeoutMs` milliseconds to complete, the player will raise an error via `Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)`.

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

      Parameters:
        `timeoutMs` - The time limit in milliseconds.

    - #### setTrackSelector

          public ExoPlayer.Builder setTrackSelector​(TrackSelector trackSelector)

      Deprecated.
      Sets the `TrackSelector` that will be used by the player.
      Parameters:
        `trackSelector` - A `TrackSelector`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setMediaSourceFactory

          public ExoPlayer.Builder setMediaSourceFactory​(MediaSourceFactory mediaSourceFactory)

      Deprecated.
      Sets the `MediaSourceFactory` that will be used by the player.
      Parameters:
        `mediaSourceFactory` - A `MediaSourceFactory`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setLoadControl

          public ExoPlayer.Builder setLoadControl​(LoadControl loadControl)

      Deprecated.
      Sets the `LoadControl` that will be used by the player.
      Parameters:
        `loadControl` - A `LoadControl`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setBandwidthMeter

          public ExoPlayer.Builder setBandwidthMeter​(BandwidthMeter bandwidthMeter)

      Deprecated.
      Sets the `BandwidthMeter` that will be used by the player.
      Parameters:
        `bandwidthMeter` - A `BandwidthMeter`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setLooper

          public ExoPlayer.Builder setLooper​(Looper looper)

      Deprecated.
      Sets the `Looper` that must be used for all calls to the player and that is used to call listeners on.
      Parameters:
        `looper` - A `Looper`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setAnalyticsCollector

          public ExoPlayer.Builder setAnalyticsCollector​(AnalyticsCollector analyticsCollector)

      Deprecated.
      Sets the `AnalyticsCollector` that will collect and forward all player events.
      Parameters:
        `analyticsCollector` - An `AnalyticsCollector`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setUseLazyPreparation

          public ExoPlayer.Builder setUseLazyPreparation​(boolean useLazyPreparation)

      Deprecated.
      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:
        `useLazyPreparation` - Whether to use lazy preparation.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setSeekParameters

          public ExoPlayer.Builder setSeekParameters​(SeekParameters seekParameters)

      Deprecated.
      Sets the parameters that control how seek operations are performed.
      Parameters:
        `seekParameters` - The `SeekParameters`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setReleaseTimeoutMs

          public ExoPlayer.Builder setReleaseTimeoutMs​(long releaseTimeoutMs)

      Deprecated.
      Sets a timeout for calls to `Player.release()` and `ExoPlayer.setForegroundMode(boolean)`.

      If a call to `Player.release()` or `ExoPlayer.setForegroundMode(boolean)` takes more than `timeoutMs` to complete, the player will report an error via `Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException)`.

      Parameters:
        `releaseTimeoutMs` - The release timeout, in milliseconds.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setPauseAtEndOfMediaItems

          public ExoPlayer.Builder setPauseAtEndOfMediaItems​(boolean pauseAtEndOfMediaItems)

      Deprecated.
      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 `timeline`. Listeners will be informed by a call to `Player.Listener.onPlayWhenReadyChanged(boolean, int)` with the reason `Player.PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM` when this happens.

      Parameters:
        `pauseAtEndOfMediaItems` - Whether to pause playback at the end of each media item.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setLivePlaybackSpeedControl

          public ExoPlayer.Builder setLivePlaybackSpeedControl​(LivePlaybackSpeedControl livePlaybackSpeedControl)

      Deprecated.
      Sets the `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:
        `livePlaybackSpeedControl` - The `LivePlaybackSpeedControl`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### setClock

          public ExoPlayer.Builder setClock​(Clock clock)

      Deprecated.
      Sets the `Clock` that will be used by the player. Should only be set for testing purposes.
      Parameters:
        `clock` - A `Clock`.
      Returns:
        This builder.
      Throws:
        `IllegalStateException` - If `build()` has already been called.

    - #### build

          public ExoPlayer build()

      Deprecated.
      Builds an `ExoPlayer` instance.
      Throws:
        `IllegalStateException` - If `build` has already been called.