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.Builderinstead.A builder forExoPlayerinstances.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 ExoPlayerbuild()Deprecated.Builds anExoPlayerinstance.ExoPlayer.BuilderexperimentalSetForegroundModeTimeoutMs(long timeoutMs)Deprecated.Set a limit on the time a call toExoPlayer.setForegroundMode(boolean)can spend.ExoPlayer.BuildersetAnalyticsCollector(AnalyticsCollector analyticsCollector)Deprecated.Sets theAnalyticsCollectorthat will collect and forward all player events.ExoPlayer.BuildersetBandwidthMeter(BandwidthMeter bandwidthMeter)Deprecated.Sets theBandwidthMeterthat will be used by the player.ExoPlayer.BuildersetClock(Clock clock)Deprecated.Sets theClockthat will be used by the player.ExoPlayer.BuildersetLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl)Deprecated.Sets theLivePlaybackSpeedControlthat will control the playback speed when playing live streams, in order to maintain a steady target offset from the live stream edge.ExoPlayer.BuildersetLoadControl(LoadControl loadControl)Deprecated.Sets theLoadControlthat will be used by the player.ExoPlayer.BuildersetLooper(Looper looper)Deprecated.Sets theLooperthat must be used for all calls to the player and that is used to call listeners on.ExoPlayer.BuildersetMediaSourceFactory(MediaSourceFactory mediaSourceFactory)Deprecated.Sets theMediaSourceFactorythat will be used by the player.ExoPlayer.BuildersetPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems)Deprecated.Sets whether to pause playback at the end of each media item.ExoPlayer.BuildersetReleaseTimeoutMs(long releaseTimeoutMs)Deprecated.Sets a timeout for calls toPlayer.release()andExoPlayer.setForegroundMode(boolean).ExoPlayer.BuildersetSeekParameters(SeekParameters seekParameters)Deprecated.Sets the parameters that control how seek operations are performed.ExoPlayer.BuildersetTrackSelector(TrackSelector trackSelector)Deprecated.Sets theTrackSelectorthat will be used by the player.ExoPlayer.BuildersetUseLazyPreparation(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:DefaultTrackSelectorMediaSourceFactory:DefaultMediaSourceFactoryLoadControl:DefaultLoadControlBandwidthMeter:DefaultBandwidthMeter.getSingletonInstance(Context)LivePlaybackSpeedControl:DefaultLivePlaybackSpeedControlLooper: TheLooperassociated with the current thread, or theLooperof the application's main thread if the current thread doesn't have aLooperAnalyticsCollector:AnalyticsCollectorwithClock.DEFAULTuseLazyPreparation:trueSeekParameters:SeekParameters.DEFAULTreleaseTimeoutMs:ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MSpauseAtEndOfMediaItems:falseClock: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- TheRenderersto 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 thantimeoutMsmilliseconds 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 theTrackSelectorthat 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 theMediaSourceFactorythat 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 theLoadControlthat 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 theBandwidthMeterthat 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 theLooperthat 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 theAnalyticsCollectorthat 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 thantimeoutMsto 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_ITEMwhen 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 theLivePlaybackSpeedControlthat 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 theClockthat 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 anExoPlayerinstance.- Throws:
IllegalStateException- Ifbuildhas already been called.
-
-