MetadataRetriever
@UnstableApi
public final class MetadataRetriever implements AutoCloseable
Retrieves information from a MediaItem without playback.
An instance is created for a single MediaItem via a Builder. It provides methods to asynchronously retrieve metadata. The instance must be closed after use to release resources.
Summary
Nested types |
|---|
public final class MetadataRetriever.BuilderBuilder for |
Constants |
|
|---|---|
static final int |
The default number of maximum parallel retrievals. |
Public methods |
|
|---|---|
void |
close() |
ListenableFuture<Long> |
Asynchronously retrieves the duration for the |
ListenableFuture<Timeline> |
|
ListenableFuture<TrackGroupArray> |
Asynchronously retrieves the |
static void |
setMaximumParallelRetrievals(int maximumParallelRetrievals)Sets the maximum number of metadata retrievals run in parallel. |
Constants
DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS
public static final int DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS = 5
The default number of maximum parallel retrievals.
Public methods
retrieveDurationUs
public ListenableFuture<Long> retrieveDurationUs()
Asynchronously retrieves the duration for the MediaItem.
| Returns | |
|---|---|
ListenableFuture<Long> |
A |
retrieveTimeline
public ListenableFuture<Timeline> retrieveTimeline()
Asynchronously retrieves the Timeline for the MediaItem.
| Returns | |
|---|---|
ListenableFuture<Timeline> |
A |
retrieveTrackGroups
public ListenableFuture<TrackGroupArray> retrieveTrackGroups()
Asynchronously retrieves the TrackGroupArray for the MediaItem.
| Returns | |
|---|---|
ListenableFuture<TrackGroupArray> |
A |
setMaximumParallelRetrievals
public static void setMaximumParallelRetrievals(int maximumParallelRetrievals)
Sets the maximum number of metadata retrievals run in parallel.
The default is DEFAULT_MAXIMUM_PARALLEL_RETRIEVALS.
| Parameters | |
|---|---|
int maximumParallelRetrievals |
The maximum number of parallel retrievals. |