DefaultPreloadManager.Builder


class DefaultPreloadManager.Builder : BasePreloadManager.BuilderBase


A builder for DefaultPreloadManager instances.

Summary

Public constructors

Builder(
    context: Context!,
    targetPreloadStatusControl: TargetPreloadStatusControl<Int!, DefaultPreloadManager.PreloadStatus!>!
)

Creates a builder.

Public functions

DefaultPreloadManager!

Builds a DefaultPreloadManager instance.

ExoPlayer!

Builds an ExoPlayer.

ExoPlayer!
buildExoPlayer(exoPlayerBuilder: ExoPlayer.Builder!)

Builds an ExoPlayer with an ExoPlayer.Builder passed in.

DefaultPreloadManager.Builder!

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

DefaultPreloadManager.Builder!

Sets the Cache that will be used for caching the media items.

DefaultPreloadManager.Builder!

Sets an Executor used to cache data.

DefaultPreloadManager.Builder!

Sets the Clock that will be used the DefaultPreloadManager.

DefaultPreloadManager.Builder!

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

DefaultPreloadManager.Builder!

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

DefaultPreloadManager.Builder!

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

DefaultPreloadManager.Builder!

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

DefaultPreloadManager.Builder!

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

Public constructors

Builder

Builder(
    context: Context!,
    targetPreloadStatusControl: TargetPreloadStatusControl<Int!, DefaultPreloadManager.PreloadStatus!>!
)

Creates a builder.

Parameters
context: Context!

A Context.

targetPreloadStatusControl: TargetPreloadStatusControl<Int!, DefaultPreloadManager.PreloadStatus!>!

A TargetPreloadStatusControl.

Public functions

build

fun build(): DefaultPreloadManager!

Builds a DefaultPreloadManager instance.

Throws
java.lang.IllegalStateException

If this method has already been called.

buildExoPlayer

fun buildExoPlayer(): ExoPlayer!

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

fun buildExoPlayer(exoPlayerBuilder: ExoPlayer.Builder!): ExoPlayer!

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
exoPlayerBuilder: ExoPlayer.Builder!

An ExoPlayer.Builder that is used to build the ExoPlayer.

Returns
ExoPlayer!

An ExoPlayer instance.

setBandwidthMeter

@CanIgnoreReturnValue
fun setBandwidthMeter(bandwidthMeter: BandwidthMeter!): DefaultPreloadManager.Builder!

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.

setCache

@CanIgnoreReturnValue
fun setCache(cache: Cache?): DefaultPreloadManager.Builder!

Sets the Cache that will be used for caching the media items.

The default is null. If an app will return specifiedRangeCached or specifiedRangeCached in its implementation of TargetPreloadStatusControl, a non-null instance must be passed.

Parameters
cache: Cache?

A Cache.

Returns
DefaultPreloadManager.Builder!

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setCachingExecutor

@CanIgnoreReturnValue
fun setCachingExecutor(executor: Executor!): DefaultPreloadManager.Builder!

Sets an Executor used to cache data.

The default is Runnable::run, which will cause each caching task to download data on a separate download thread. Passing an Executor that uses multiple threads will speed up caching tasks that can be split into smaller parts for parallel execution.

Parameters
executor: Executor!

An Executor.

Returns
DefaultPreloadManager.Builder!

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setClock

@VisibleForTesting
@CanIgnoreReturnValue
fun setClock(clock: Clock!): DefaultPreloadManager.Builder!

Sets the Clock that will be used the DefaultPreloadManager. Should only be set for testing purposes.

Returns
DefaultPreloadManager.Builder!

This builder.

setLoadControl

@CanIgnoreReturnValue
fun setLoadControl(loadControl: LoadControl!): DefaultPreloadManager.Builder!

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
fun setMediaSourceFactory(mediaSourceFactory: MediaSource.Factory!): DefaultPreloadManager.Builder!

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

The default is a DefaultMediaSourceFactory.

Parameters
mediaSourceFactory: MediaSource.Factory!

A MediaSource.Factory

Returns
DefaultPreloadManager.Builder!

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.

setPreloadLooper

@CanIgnoreReturnValue
fun setPreloadLooper(preloadLooper: Looper!): DefaultPreloadManager.Builder!

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
preloadLooper: Looper!

A Looper.

Returns
DefaultPreloadManager.Builder!

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called, or when the main looper is passed in.

setRenderersFactory

@CanIgnoreReturnValue
fun setRenderersFactory(renderersFactory: RenderersFactory!): DefaultPreloadManager.Builder!

Sets the RenderersFactory that will be used by the built DefaultPreloadManager 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
fun setTrackSelectorFactory(trackSelectorFactory: TrackSelector.Factory!): DefaultPreloadManager.Builder!

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

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

Parameters
trackSelectorFactory: TrackSelector.Factory!

A TrackSelector.Factory.

Returns
DefaultPreloadManager.Builder!

This builder.

Throws
java.lang.IllegalStateException

If build, buildExoPlayer or buildExoPlayer has already been called.