DefaultPreloadManager.Builder


public final class DefaultPreloadManager.Builder extends BasePreloadManager.BuilderBase


A builder for DefaultPreloadManager instances.

Summary

Public constructors

Builder(
    Context context,
    TargetPreloadStatusControl<Integer> targetPreloadStatusControl
)

Creates a builder.

Public constructors

Builder

public Builder(
    Context context,
    TargetPreloadStatusControl<Integer> targetPreloadStatusControl
)

Creates a builder.

Parameters
Context context

A Context.

TargetPreloadStatusControl<Integer> targetPreloadStatusControl

A <.

Public methods

build

public DefaultPreloadManager build()

Builds a DefaultPreloadManager instance.

Throws
java.lang.IllegalStateException

If this method has already been called.

buildExoPlayer

public ExoPlayer buildExoPlayer()

Builds an ExoPlayer.

See buildExoPlayer for the list of values populated on and resulting from this builder that the built ExoPlayer uses.

For the other configurations than above, the built ExoPlayer uses the default values, see Builder for the list of default values.

Returns
ExoPlayer

An ExoPlayer instance.

buildExoPlayer

public ExoPlayer buildExoPlayer(ExoPlayer.Builder exoPlayerBuilder)

Builds an ExoPlayer with an ExoPlayer.Builder passed in.

The built ExoPlayer uses the following values populated on and resulting from this builder:

For the other configurations than above, the built ExoPlayer uses the values from the passed ExoPlayer.Builder.

Parameters
ExoPlayer.Builder exoPlayerBuilder

An ExoPlayer.Builder that is used to build the .

Returns
ExoPlayer

An ExoPlayer instance.

setBandwidthMeter

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setBandwidthMeter(BandwidthMeter bandwidthMeter)

Sets the BandwidthMeter that will be used by the built DefaultPreloadManager and ExoPlayer.

The default is a DefaultBandwidthMeter.

Parameters
BandwidthMeter bandwidthMeter

A BandwidthMeter.

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setLoadControl

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setLoadControl(LoadControl loadControl)

Sets the LoadControl that will be used by the built DefaultPreloadManager and ExoPlayer.

The default is a DefaultLoadControl.

Parameters
LoadControl loadControl

A LoadControl.

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setMediaSourceFactory

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory)

Sets the MediaSource.Factory that will be used by the built and ExoPlayer.

The default is a DefaultMediaSourceFactory.

Parameters
MediaSource.Factory mediaSourceFactory

A MediaSource.Factory

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setPreloadLooper

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setPreloadLooper(Looper preloadLooper)

Sets the Looper that will be used for preload and playback.

The backing thread should run with priority THREAD_PRIORITY_AUDIO and should handle messages within 10ms.

The default is a looper that is associated with a new thread created internally.

Parameters
Looper preloadLooper

A Looper.

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setRenderersFactory

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setRenderersFactory(RenderersFactory renderersFactory)

Sets the RenderersFactory that will be used by the built and ExoPlayer.

The default is a DefaultRenderersFactory.

Parameters
RenderersFactory renderersFactory

A RenderersFactory.

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setTrackSelectorFactory

@CanIgnoreReturnValue
public DefaultPreloadManager.Builder setTrackSelectorFactory(TrackSelector.Factory trackSelectorFactory)

Sets the TrackSelector.Factory that will be used by the built and ExoPlayer.

The default is a TrackSelector.Factory that always creates a new .

Parameters
TrackSelector.Factory trackSelectorFactory

A TrackSelector.Factory.

Returns
DefaultPreloadManager.Builder

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.