MetadataRetriever


@UnstableApi
class MetadataRetriever


Retrieves the static metadata of MediaItems.

Summary

Constants

const Int

The default number of maximum parallel retrievals.

Public functions

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

Retrieves the TrackGroupArray corresponding to a MediaItem.

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

Retrieves the TrackGroupArray corresponding to a 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

retrieveMetadata

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

Retrieves the TrackGroupArray corresponding to a MediaItem.

This is equivalent to using retrieveMetadata with a DefaultMediaSourceFactory and a DefaultExtractorsFactory with FLAG_READ_MOTION_PHOTO_METADATA and FLAG_READ_SEF_DATA set.

Parameters
context: Context!

The Context.

mediaItem: MediaItem!

The MediaItem whose metadata should be retrieved.

Returns
ListenableFuture<TrackGroupArray!>!

A ListenableFuture of the result.

retrieveMetadata

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

Retrieves the TrackGroupArray corresponding to a MediaItem.

This method is thread-safe.

Parameters
mediaSourceFactory: MediaSource.Factory!

mediaSourceFactory The MediaSource.Factory to use to read the data.

mediaItem: MediaItem!

The MediaItem whose metadata should be retrieved.

Returns
ListenableFuture<TrackGroupArray!>!

A ListenableFuture of the result.

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.