PillarboxPreloadManager

class PillarboxPreloadManager(context: Context, targetPreloadStatusControl: TargetPreloadStatusControl<Int>? = null, mediaSourceFactory: PillarboxMediaSourceFactory = PillarboxMediaSourceFactory(context), trackSelector: TrackSelector = PillarboxTrackSelector(context), bandwidthMeter: BandwidthMeter = PillarboxBandwidthMeter(context), rendererCapabilitiesListFactory: RendererCapabilitiesList.Factory = DefaultRendererCapabilitiesList.Factory( PillarboxRenderersFactory(context) ), val allocator: DefaultAllocator = DefaultAllocator(false, C.DEFAULT_BUFFER_SEGMENT_SIZE), playbackThread: HandlerThread = HandlerThread("PillarboxPreloadManager:Playback", Process.THREAD_PRIORITY_AUDIO))

Helper class for the Media3's DefaultPreloadManager.

Parameters

context

The current Context.

targetPreloadStatusControl

The TargetPreloadStatusControl to decide when to preload an item and for how long.

mediaSourceFactory
trackSelector

The TrackSelector for this preload manager.

bandwidthMeter

The BandwidthMeter for this preload manager.

rendererCapabilitiesListFactory

The RendererCapabilitiesList.Factory for this preload manager.

playbackThread

The Thread on which the players run. Its lifecycle is handled internally by PillarboxPreloadManager.

See also

Constructors

Link copied to clipboard
constructor(context: Context, targetPreloadStatusControl: TargetPreloadStatusControl<Int>? = null, mediaSourceFactory: PillarboxMediaSourceFactory = PillarboxMediaSourceFactory(context), trackSelector: TrackSelector = PillarboxTrackSelector(context), bandwidthMeter: BandwidthMeter = PillarboxBandwidthMeter(context), rendererCapabilitiesListFactory: RendererCapabilitiesList.Factory = DefaultRendererCapabilitiesList.Factory( PillarboxRenderersFactory(context) ), allocator: DefaultAllocator = DefaultAllocator(false, C.DEFAULT_BUFFER_SEGMENT_SIZE), playbackThread: HandlerThread = HandlerThread("PillarboxPreloadManager:Playback", Process.THREAD_PRIORITY_AUDIO))

Types

Link copied to clipboard

Default implementation of TargetPreloadStatusControl that will preload the first second of the n ± 1 item, and the first half-second of the n ± 2,3 item, where n is the index of the current item.

Properties

Link copied to clipboard

The Allocator for this preload manager. Have to be the same as the one used by the Player.

Link copied to clipboard

The index of the currently playing media item.

Link copied to clipboard

Playback looper to use with PillarboxExoPlayer.

Link copied to clipboard

Get the count of MediaSource currently managed by this preload manager.

Functions

Link copied to clipboard
fun add(mediaItem: MediaItem, rankingData: Int)

Add a MediaItem with its rankingData to the preload manager.

fun add(mediaSource: MediaSource, rankingData: Int)

Add a MediaSource with its rankingData to the preload manager.

Link copied to clipboard

Returns the MediaSource for the given MediaItem.

Link copied to clipboard

Invalidate the current preload manager.

Link copied to clipboard
fun release()

Release the preload manager. The preload manager must not be used after calling this method.

Link copied to clipboard
fun remove(mediaItem: MediaItem): Boolean

Remove a MediaItem from the preload manager.

fun remove(mediaSource: MediaSource): Boolean

Remove a MediaSource from the preload manager.

Link copied to clipboard
fun reset()

Reset the preload manager. All sources that the preload manager is holding will be released.