DefaultPreloadManager


@UnstableApi
class DefaultPreloadManager : BasePreloadManager


A preload manager that preloads with the PreloadMediaSource to load the media data into the SampleQueue.

Summary

Nested types

A builder for DefaultPreloadManager instances.

Defines the preload status for the DefaultPreloadManager.

Stages for the preload status.

Public functions

Unit
setCurrentPlayingIndex(currentPlayingIndex: Int)

Sets the index of the current playing media.

Protected functions

BasePreloadManager.MediaSourceHolder!
createMediaSourceHolder(
    mediaItem: MediaItem!,
    mediaSource: MediaSource?,
    rankingData: Int!
)

Returns the MediaSourceHolder that the preload manager creates for preloading based on the given MediaItem and MediaSource.

Unit

Preloads the given MediaSourceHolder.

Unit

Releases the preload manager, see release.

Unit

Releases the given MediaSourceHolder.

Inherited functions

From androidx.media3.exoplayer.source.preload.BasePreloadManager
Unit
add(mediaItem: MediaItem!, rankingData: T!)

Adds a MediaItem with its rankingData to the preload manager.

Unit
add(mediaSource: MediaSource!, rankingData: T!)

Adds a MediaSource with its rankingData to the preload manager.

Unit

Adds a PreloadManagerListener to listen to the preload events.

Unit
addMediaItems(
    mediaItems: (Mutable)List<MediaItem!>!,
    rankingDataList: (Mutable)List<T!>!
)

Adds a list of media items with their rankingData to the preload manager.

Unit
addMediaSources(
    mediaSources: (Mutable)List<MediaSource!>!,
    rankingDataList: (Mutable)List<T!>!
)

Adds a list of media sources with their rankingData to the preload manager.

Unit

Clears all the listeners.

MediaSource?

Returns the MediaSource for the given MediaItem.

BasePreloadManager.MediaSourceHolder?
Int

Gets the count of the media sources currently being managed by the preload manager.

PreloadStatusT?
PreloadStatusT?
Unit

Invalidates the current preload progress, and triggers a new preload progress based on the new priorities of the managed media sources.

Unit
onCompleted(
    mediaItem: MediaItem!,
    shouldNotifyListenerAndAdvancePredicate: Predicate<PreloadStatusT!>!
)

Called when the given MediaItem completes preloading.

Unit
onCompleted(
    mediaSource: MediaSource!,
    shouldNotifyListenerAndAdvancePredicate: Predicate<PreloadStatusT!>!
)

Called when the given MediaSource completes preloading.

Unit
onError(
    error: PreloadException!,
    mediaItem: MediaItem!,
    shouldNotifyListenerAndAdvancePredicate: Predicate<PreloadStatusT!>!
)

Called when an error occurs.

Unit
onError(
    error: PreloadException!,
    mediaSource: MediaSource!,
    shouldNotifyListenerAndAdvancePredicate: Predicate<PreloadStatusT!>!
)

Called when an error occurs.

Unit
onMediaSourceUpdated(
    mediaItem: MediaItem!,
    updatedMediaSource: MediaSource!
)

Called when the given MediaItem has its corresponding MediaSource updated.

Unit
onSkipped(
    mediaSource: MediaSource!,
    shouldAdvancePredicate: Predicate<PreloadStatusT!>!
)

Called when the given MediaSource has been skipped before completing preloading.

Unit

Called when there is a MediaSource has been cleared.

Unit

Releases the preload manager.

Boolean
remove(mediaItem: MediaItem!)

Removes a MediaItem from the preload manager.

Boolean
remove(mediaSource: MediaSource!)

Removes a MediaSource from the preload manager.

Unit

Removes a PreloadManagerListener.

Unit

Removes a list of media items from the preload manager.

Unit

Removes a list of media sources from the preload manager.

Unit

Resets the preload manager.

Boolean

Returns whether the next MediaSource should start preloading.

Public functions

setCurrentPlayingIndex

fun setCurrentPlayingIndex(currentPlayingIndex: Int): Unit

Sets the index of the current playing media.

Parameters
currentPlayingIndex: Int

The index of current playing media.

Protected functions

createMediaSourceHolder

protected fun createMediaSourceHolder(
    mediaItem: MediaItem!,
    mediaSource: MediaSource?,
    rankingData: Int!
): BasePreloadManager.MediaSourceHolder!

Returns the MediaSourceHolder that the preload manager creates for preloading based on the given MediaItem and MediaSource.

Parameters
mediaItem: MediaItem!

The MediaItem.

mediaSource: MediaSource?

The MediaSource based on which the preload manager creates for preloading.

rankingData: Int!

The ranking data that is associated with the mediaItem.

Returns
BasePreloadManager.MediaSourceHolder!

The MediaSourceHolder the preload manager creates for preloading.

preloadMediaSourceHolderInternal

protected fun preloadMediaSourceHolderInternal(
    mediaSourceHolder: BasePreloadManager.MediaSourceHolder!,
    targetPreloadStatus: DefaultPreloadManager.PreloadStatus!
): Unit

Preloads the given MediaSourceHolder.

Parameters
mediaSourceHolder: BasePreloadManager.MediaSourceHolder!

The MediaSourceHolder to preload.

targetPreloadStatus: DefaultPreloadManager.PreloadStatus!

The target preload status.

releaseInternal

protected fun releaseInternal(): Unit

Releases the preload manager, see release.

releaseMediaSourceHolderInternal

protected fun releaseMediaSourceHolderInternal(
    mediaSourceHolder: BasePreloadManager.MediaSourceHolder!
): Unit

Releases the given MediaSourceHolder.

Parameters
mediaSourceHolder: BasePreloadManager.MediaSourceHolder!

The MediaSourceHolder to remove.