MetadataRetriever


@UnstableApi
class MetadataRetriever : AutoCloseable


Summary

Nested types

Builder for MetadataRetriever instances.

Constants

const Int

The default number of maximum parallel retrievals.

Public functions

Unit
ListenableFuture<Long!>!

Asynchronously retrieves the duration for the MediaItem.

java-static ListenableFuture<TrackGroupArray!>!
retrieveMetadata(context: Context!, mediaItem: MediaItem!)

This function is deprecated.

Use Builder to create an instance and call retrieveTrackGroups instead.

java-static ListenableFuture<TrackGroupArray!>!
retrieveMetadata(
    mediaSourceFactory: MediaSource.Factory!,
    mediaItem: MediaItem!
)

This function is deprecated.

Use Builder to create an instance and call retrieveTrackGroups instead.

ListenableFuture<Timeline!>!

Asynchronously retrieves the Timeline for the MediaItem.

ListenableFuture<TrackGroupArray!>!

Asynchronously retrieves the TrackGroupArray for the MediaItem.

java-static Unit
setMaximumParallelRetrievals(maximumParallelRetrievals: Int)

Sets the maximum number of metadata retrievals run in parallel.

Constants

DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS

const val DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS = 5: Int

The default number of maximum parallel retrievals.

Public functions

close

fun close(): Unit

retrieveDurationUs

fun retrieveDurationUs(): ListenableFuture<Long!>!

Asynchronously retrieves the duration for the MediaItem.

Returns
ListenableFuture<Long!>!

A ListenableFuture that will be populated with the duration in microseconds, or TIME_UNSET if unknown.

retrieveMetadata

java-static fun retrieveMetadata(context: Context!, mediaItem: MediaItem!): ListenableFuture<TrackGroupArray!>!

retrieveMetadata

java-static fun retrieveMetadata(
    mediaSourceFactory: MediaSource.Factory!,
    mediaItem: MediaItem!
): ListenableFuture<TrackGroupArray!>!

retrieveTimeline

fun retrieveTimeline(): ListenableFuture<Timeline!>!

Asynchronously retrieves the Timeline for the MediaItem.

Returns
ListenableFuture<Timeline!>!

A ListenableFuture that will be populated with the Timeline.

retrieveTrackGroups

fun retrieveTrackGroups(): ListenableFuture<TrackGroupArray!>!

Asynchronously retrieves the TrackGroupArray for the MediaItem.

Returns
ListenableFuture<TrackGroupArray!>!

A ListenableFuture that will be populated with the TrackGroupArray.

setMaximumParallelRetrievals

java-static fun setMaximumParallelRetrievals(maximumParallelRetrievals: Int): Unit

Sets the maximum number of metadata retrievals run in parallel.

The default is DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS.

Parameters
maximumParallelRetrievals: Int

The maximum number of parallel retrievals.