ContentMetadata
@UnstableApi
public interface ContentMetadata
DefaultContentMetadata |
Default implementation of |
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[] |
Returns a metadata value. |
abstract long |
Returns a metadata value. |
abstract @Nullable String |
Returns a metadata value. |
default static long |
getContentLength(ContentMetadata contentMetadata) Returns the value stored under |
default static @Nullable Uri |
getRedirectedUri(ContentMetadata contentMetadata) Returns the value stored under |
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
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.
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.