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.UseSimpleExoPlayer.Builder
instead.A builder forExoPlayer
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 ofRenderers
.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 anExoPlayer
instance.ExoPlayer.Builder
experimentalSetForegroundModeTimeoutMs(long timeoutMs)
Deprecated.Set a limit on the time a call toExoPlayer.setForegroundMode(boolean)
can spend.ExoPlayer.Builder
setAnalyticsCollector(AnalyticsCollector analyticsCollector)
Deprecated.Sets theAnalyticsCollector
that will collect and forward all player events.ExoPlayer.Builder
setBandwidthMeter(BandwidthMeter bandwidthMeter)
Deprecated.Sets theBandwidthMeter
that will be used by the player.ExoPlayer.Builder
setClock(Clock clock)
Deprecated.Sets theClock
that will be used by the player.ExoPlayer.Builder
setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl)
Deprecated.Sets theLivePlaybackSpeedControl
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 theLoadControl
that will be used by the player.ExoPlayer.Builder
setLooper(Looper looper)
Deprecated.Sets theLooper
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 theMediaSourceFactory
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 toPlayer.release()
andExoPlayer.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 theTrackSelector
that will be used by the player.ExoPlayer.Builder
setUseLazyPreparation(boolean useLazyPreparation)
Deprecated.Sets whether media sources should be initialized lazily.
-
-
-
Constructor Detail
-
Builder
public Builder(Context context, Renderer... renderers)
Deprecated.Creates a builder with a list ofRenderers
.The builder uses the following default values:
TrackSelector
:DefaultTrackSelector
MediaSourceFactory
:DefaultMediaSourceFactory
LoadControl
:DefaultLoadControl
BandwidthMeter
:DefaultBandwidthMeter.getSingletonInstance(Context)
LivePlaybackSpeedControl
:DefaultLivePlaybackSpeedControl
Looper
: TheLooper
associated with the current thread, or theLooper
of the application's main thread if the current thread doesn't have aLooper
AnalyticsCollector
:AnalyticsCollector
withClock.DEFAULT
useLazyPreparation
:true
SeekParameters
:SeekParameters.DEFAULT
releaseTimeoutMs
:ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MS
pauseAtEndOfMediaItems
:false
Clock
:Clock.DEFAULT
-
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
- TheRenderers
to be used by the player.trackSelector
- ATrackSelector
.mediaSourceFactory
- AMediaSourceFactory
.loadControl
- ALoadControl
.bandwidthMeter
- ABandwidthMeter
.
-
-
Method Detail
-
experimentalSetForegroundModeTimeoutMs
public ExoPlayer.Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs)
Deprecated.Set a limit on the time a call toExoPlayer.setForegroundMode(boolean)
can spend. If a call toExoPlayer.setForegroundMode(boolean)
takes more thantimeoutMs
milliseconds to complete, the player will raise an error viaPlayer.EventListener.onPlayerError(com.google.android.exoplayer2.ExoPlaybackException)
.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 theTrackSelector
that will be used by the player.- Parameters:
trackSelector
- ATrackSelector
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setMediaSourceFactory
public ExoPlayer.Builder setMediaSourceFactory(MediaSourceFactory mediaSourceFactory)
Deprecated.Sets theMediaSourceFactory
that will be used by the player.- Parameters:
mediaSourceFactory
- AMediaSourceFactory
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setLoadControl
public ExoPlayer.Builder setLoadControl(LoadControl loadControl)
Deprecated.Sets theLoadControl
that will be used by the player.- Parameters:
loadControl
- ALoadControl
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setBandwidthMeter
public ExoPlayer.Builder setBandwidthMeter(BandwidthMeter bandwidthMeter)
Deprecated.Sets theBandwidthMeter
that will be used by the player.- Parameters:
bandwidthMeter
- ABandwidthMeter
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setLooper
public ExoPlayer.Builder setLooper(Looper looper)
Deprecated.Sets theLooper
that must be used for all calls to the player and that is used to call listeners on.- Parameters:
looper
- ALooper
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setAnalyticsCollector
public ExoPlayer.Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector)
Deprecated.Sets theAnalyticsCollector
that will collect and forward all player events.- Parameters:
analyticsCollector
- AnAnalyticsCollector
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
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
- Ifbuild()
has already been called.
-
setSeekParameters
public ExoPlayer.Builder setSeekParameters(SeekParameters seekParameters)
Deprecated.Sets the parameters that control how seek operations are performed.- Parameters:
seekParameters
- TheSeekParameters
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setReleaseTimeoutMs
public ExoPlayer.Builder setReleaseTimeoutMs(long releaseTimeoutMs)
Deprecated.Sets a timeout for calls toPlayer.release()
andExoPlayer.setForegroundMode(boolean)
.If a call to
Player.release()
orExoPlayer.setForegroundMode(boolean)
takes more thantimeoutMs
to complete, the player will report an error viaPlayer.EventListener.onPlayerError(com.google.android.exoplayer2.ExoPlaybackException)
.- Parameters:
releaseTimeoutMs
- The release timeout, in milliseconds.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
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 toPlayer.EventListener.onPlayWhenReadyChanged(boolean, int)
with the reasonPlayer.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
- Ifbuild()
has already been called.
-
setLivePlaybackSpeedControl
public ExoPlayer.Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl)
Deprecated.Sets theLivePlaybackSpeedControl
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
- TheLivePlaybackSpeedControl
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
setClock
public ExoPlayer.Builder setClock(Clock clock)
Deprecated.Sets theClock
that will be used by the player. Should only be set for testing purposes.- Parameters:
clock
- AClock
.- Returns:
- This builder.
- Throws:
IllegalStateException
- Ifbuild()
has already been called.
-
build
public ExoPlayer build()
Deprecated.Builds anExoPlayer
instance.- Throws:
IllegalStateException
- Ifbuild
has already been called.
-
-