@UnstableApi
public interface ContentMetadata

Known direct subclasses
DefaultContentMetadata

Default implementation of ContentMetadata.


Interface for an immutable snapshot of keyed metadata.

Summary

Constants

default static final String
KEY_CONTENT_LENGTH = "exo_len"

Key for content length in bytes (type: long).

default static final String
KEY_CUSTOM_PREFIX = "custom_"

Prefix for custom metadata keys.

default static final String
KEY_REDIRECTED_URI = "exo_redir"

Key for redirected uri (type: String).

Public methods

abstract boolean

Returns whether the metadata is available.

abstract @Nullable byte[]
get(String key, @Nullable byte[] defaultValue)

Returns a metadata value.

abstract long
get(String key, long defaultValue)

Returns a metadata value.

abstract @Nullable String
get(String key, @Nullable String defaultValue)

Returns a metadata value.

default static long

Returns the value stored under KEY_CONTENT_LENGTH, or LENGTH_UNSET if not set.

default static @Nullable Uri

Returns the value stored under KEY_REDIRECTED_URI as a Uri, or {code null} if not set.

Constants

KEY_CONTENT_LENGTH

default static final String KEY_CONTENT_LENGTH = "exo_len"

Key for content length in bytes (type: long).

KEY_CUSTOM_PREFIX

default static final String KEY_CUSTOM_PREFIX = "custom_"

Prefix for custom metadata keys. Applications can use keys starting with this prefix without any risk of their keys colliding with ones defined by the ExoPlayer library.

KEY_REDIRECTED_URI

default static final String KEY_REDIRECTED_URI = "exo_redir"

Key for redirected uri (type: String).

Public methods

contains

abstract boolean contains(String key)

Returns whether the metadata is available.

get

abstract @Nullable byte[] get(String key, @Nullable byte[] defaultValue)

Returns a metadata value.

Parameters
String key

Key of the metadata to be returned.

@Nullable byte[] defaultValue

Value to return if the metadata doesn't exist.

Returns
@Nullable byte[]

The metadata value.

get

abstract long get(String key, long defaultValue)

Returns a metadata value.

Parameters
String key

Key of the metadata to be returned.

long defaultValue

Value to return if the metadata doesn't exist.

Returns
long

The metadata value.

get

abstract @Nullable String get(String key, @Nullable String defaultValue)

Returns a metadata value.

Parameters
String key

Key of the metadata to be returned.

@Nullable String defaultValue

Value to return if the metadata doesn't exist.

Returns
@Nullable String

The metadata value.

getContentLength

default static long getContentLength(ContentMetadata contentMetadata)

Returns the value stored under KEY_CONTENT_LENGTH, or LENGTH_UNSET if not set.

getRedirectedUri

default static @Nullable Uri getRedirectedUri(ContentMetadata contentMetadata)

Returns the value stored under KEY_REDIRECTED_URI as a Uri, or {code null} if not set.