PreCacheHelper.Factory


class PreCacheHelper.Factory


A factory for PreCacheHelper.

Summary

Public constructors

Factory(context: Context!, cache: Cache!, preCacheLooper: Looper!)

Creates a Factory.

Factory(
    cache: Cache!,
    upstreamDataSourceFactory: DataSource.Factory!,
    renderersFactory: RenderersFactory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Factory(
    context: Context!,
    cache: Cache!,
    renderersFactory: RenderersFactory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Factory(
    context: Context!,
    cache: Cache!,
    upstreamDataSourceFactory: DataSource.Factory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Public functions

PreCacheHelper!
create(mediaItem: MediaItem!)

Creates a PreCacheHelper instance.

PreCacheHelper.Factory!

Sets an Executor used to download data.

PreCacheHelper.Factory!

Sets the Listener.

PreCacheHelper.Factory!

Sets a TrackSelectionParameters for selecting tracks for pre-caching.

Public constructors

Factory

Factory(context: Context!, cache: Cache!, preCacheLooper: Looper!)

Creates a Factory.

Parameters
context: Context!

The Context.

cache: Cache!

The Cache instance that will be used.

preCacheLooper: Looper!

The Looper that operates the pre-caching flow. Note that this looper is not responsible for downloading the data.

Factory

Factory(
    cache: Cache!,
    upstreamDataSourceFactory: DataSource.Factory!,
    renderersFactory: RenderersFactory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Parameters
cache: Cache!

The Cache instance that will be used.

upstreamDataSourceFactory: DataSource.Factory!

The upstream DataSource.Factory for reading data not in the cache.

renderersFactory: RenderersFactory!

The RenderersFactory creating the renderers for which tracks are selected.

preCacheLooper: Looper!

The Looper that operates the pre-caching flow. Note that this looper is not responsible for downloading the data.

Factory

Factory(
    context: Context!,
    cache: Cache!,
    renderersFactory: RenderersFactory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Parameters
context: Context!

The Context.

cache: Cache!

The Cache instance that will be used.

renderersFactory: RenderersFactory!

The RenderersFactory creating the renderers for which tracks are selected.

preCacheLooper: Looper!

The Looper that operates the pre-caching flow. Note that this looper is not responsible for downloading the data.

Factory

Factory(
    context: Context!,
    cache: Cache!,
    upstreamDataSourceFactory: DataSource.Factory!,
    preCacheLooper: Looper!
)

Creates a Factory.

Parameters
context: Context!

The Context.

cache: Cache!

The Cache instance that will be used.

upstreamDataSourceFactory: DataSource.Factory!

The upstream DataSource.Factory for reading data not in the cache.

preCacheLooper: Looper!

The Looper that operates the pre-caching flow. Note that this looper is not responsible for downloading the data.

Public functions

create

fun create(mediaItem: MediaItem!): PreCacheHelper!

Creates a PreCacheHelper instance.

Parameters
mediaItem: MediaItem!

The MediaItem to pre-cache.

setDownloadExecutor

@CanIgnoreReturnValue
fun setDownloadExecutor(downloadExecutor: Executor!): PreCacheHelper.Factory!

Sets an Executor used to download data.

The default is a single threaded scheduled executor.

Passing Runnable::run will cause each download task to download data on its own thread. Passing an Executor that uses multiple threads will speed up download tasks that can be split into smaller parts for parallel execution.

Returns
PreCacheHelper.Factory!

This factory, for convenience.

setListener

@CanIgnoreReturnValue
fun setListener(listener: PreCacheHelper.Listener?): PreCacheHelper.Factory!

Sets the Listener.

Returns
PreCacheHelper.Factory!

This factory, for convenience.

setTrackSelectionParameters

@CanIgnoreReturnValue
fun setTrackSelectionParameters(
    trackSelectionParameters: TrackSelectionParameters!
): PreCacheHelper.Factory!

Sets a TrackSelectionParameters for selecting tracks for pre-caching.

The default is DEFAULT.

This is only used for adaptive streams.

Returns
PreCacheHelper.Factory!

This factory, for convenience.