MimeTypes
class MimeTypes
Defines common MIME types and helper methods.
Summary
Constants |
|
|---|---|
const String! |
APPLICATION_AIT = "application/vnd.dvb.ait" |
const String! |
@UnstableApi |
const String! |
APPLICATION_CEA608 = "application/cea-608" |
const String! |
APPLICATION_CEA708 = "application/cea-708" |
const String! |
@UnstableApi |
const String! |
APPLICATION_DVBSUBS = "application/dvbsubs" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApiMIME type for an image URI loaded from an external image management framework. |
const String! |
@UnstableApi |
const String! |
APPLICATION_ID3 = "application/id3" |
const String! |
APPLICATION_M3U8 = "application/x-mpegURL" |
const String! |
APPLICATION_MATROSKA = "application/x-matroska" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
APPLICATION_MP4 = "application/mp4" |
const String! |
APPLICATION_MP4CEA608 = "application/x-mp4-cea-608" |
const String! |
APPLICATION_MP4VTT = "application/x-mp4-vtt" |
const String! |
APPLICATION_MPD = "application/dash+xml" |
const String! |
APPLICATION_PGS = "application/pgs" |
const String! |
APPLICATION_RAWCC = "application/x-rawcc"This property is deprecated. RawCC is a Google-internal subtitle format that isn't supported by this version of Media3. |
const String! |
APPLICATION_RTSP = "application/x-rtsp" |
const String! |
@UnstableApi |
const String! |
APPLICATION_SDP = "application/sdp" |
const String! |
APPLICATION_SS = "application/vnd.ms-sstr+xml" |
const String! |
APPLICATION_SUBRIP = "application/x-subrip" |
const String! |
APPLICATION_TTML = "application/ttml+xml" |
const String! |
APPLICATION_TX3G = "application/x-quicktime-tx3g" |
const String! |
APPLICATION_VOBSUB = "application/vobsub" |
const String! |
APPLICATION_WEBM = "application/webm" |
const String! |
AUDIO_AAC = "audio/mp4a-latm" |
const String! |
AUDIO_AC3 = "audio/ac3" |
const String! |
AUDIO_AC4 = "audio/ac4" |
const String! |
AUDIO_ALAC = "audio/alac" |
const String! |
AUDIO_ALAW = "audio/g711-alaw" |
const String! |
AUDIO_AMR = "audio/amr" |
const String! |
AUDIO_AMR_NB = "audio/3gpp" |
const String! |
AUDIO_AMR_WB = "audio/amr-wb" |
const String! |
AUDIO_DTS = "audio/vnd.dts" |
const String! |
AUDIO_DTS_EXPRESS = "audio/vnd.dts.hd;profile=lbr" |
const String! |
AUDIO_DTS_HD = "audio/vnd.dts.hd" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
AUDIO_E_AC3 = "audio/eac3" |
const String! |
AUDIO_E_AC3_JOC = "audio/eac3-joc" |
const String! |
AUDIO_FLAC = "audio/flac" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
AUDIO_MIDI = "audio/midi" |
const String! |
AUDIO_MLAW = "audio/g711-mlaw" |
const String! |
AUDIO_MP4 = "audio/mp4" |
const String! |
AUDIO_MPEG = "audio/mpeg" |
const String! |
AUDIO_MPEGH_MHA1 = "audio/mha1" |
const String! |
AUDIO_MPEGH_MHM1 = "audio/mhm1" |
const String! |
AUDIO_MPEG_L1 = "audio/mpeg-L1" |
const String! |
AUDIO_MPEG_L2 = "audio/mpeg-L2" |
const String! |
AUDIO_MSGSM = "audio/gsm" |
const String! |
AUDIO_OGG = "audio/ogg" |
const String! |
AUDIO_OPUS = "audio/opus" |
const String! |
AUDIO_RAW = "audio/raw" |
const String! |
AUDIO_TRUEHD = "audio/true-hd" |
const String! |
@UnstableApi |
const String! |
AUDIO_VORBIS = "audio/vorbis" |
const String! |
AUDIO_WAV = "audio/wav" |
const String! |
AUDIO_WEBM = "audio/webm" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApiA non-standard codec string for E-AC3-JOC. |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
IMAGE_JPEG = "image/jpeg" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
TEXT_SSA = "text/x-ssa" |
const String! |
@UnstableApi |
const String! |
TEXT_VTT = "text/vtt" |
const String! |
@UnstableApi |
const String! |
VIDEO_AV1 = "video/av01" |
const String! |
VIDEO_AVI = "video/x-msvideo" |
const String! |
VIDEO_DIVX = "video/divx" |
const String! |
VIDEO_DOLBY_VISION = "video/dolby-vision" |
const String! |
@UnstableApi |
const String! |
VIDEO_H263 = "video/3gpp" |
const String! |
VIDEO_H264 = "video/avc" |
const String! |
VIDEO_H265 = "video/hevc" |
const String! |
@UnstableApi |
const String! |
VIDEO_MJPEG = "video/mjpeg" |
const String! |
VIDEO_MP2T = "video/mp2t" |
const String! |
VIDEO_MP4 = "video/mp4" |
const String! |
VIDEO_MP42 = "video/mp42" |
const String! |
VIDEO_MP43 = "video/mp43" |
const String! |
VIDEO_MP4V = "video/mp4v-es" |
const String! |
VIDEO_MPEG = "video/mpeg" |
const String! |
VIDEO_MPEG2 = "video/mpeg2" |
const String! |
@UnstableApi |
const String! |
VIDEO_OGG = "video/ogg" |
const String! |
VIDEO_PS = "video/mp2p" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
VIDEO_VC1 = "video/wvc1" |
const String! |
@UnstableApi |
const String! |
@UnstableApi |
const String! |
VIDEO_WEBM = "video/webm" |
Public functions |
|
|---|---|
java-static Boolean |
@UnstableApiReturns true if it is known that all samples in a stream of the given MIME type and codec are guaranteed to be sync samples (i.e., |
java-static Boolean |
@UnstableApiReturns whether the given |
java-static String? |
@UnstableApiReturns the first audio MIME type derived from an RFC 6381 codecs string. |
java-static String? |
@UnstableApiReturns a subsequence of |
java-static Int |
@UnstableApiReturns the |
java-static String? |
@UnstableApiReturns the MIME type corresponding to an RFC 6381 codec string, or |
java-static String? |
@UnstableApiReturns the MIME type corresponding to an MP4 object type identifier, as defined in RFC 6381 and https://mp4ra.org/#/object_types. |
java-static Byte? |
@UnstableApiReturns the MP4 object type identifier corresponding to a MIME type, as defined in RFC 6381 and MPEG-4 Object Types. |
java-static String? |
@UnstableApiReturns the first text MIME type derived from an RFC 6381 codecs string. |
java-static Int |
@UnstableApiReturns the |
java-static Int |
@UnstableApiEquivalent to |
java-static String? |
@UnstableApiReturns the first video MIME type derived from an RFC 6381 codecs string. |
java-static Boolean |
@UnstableApiReturns whether the given string is an audio MIME type. |
java-static Boolean |
@UnstableApiReturns whether the given |
java-static Boolean |
@UnstableApiReturns whether the given string is an image MIME type. |
java-static Boolean |
@UnstableApiReturns whether the given |
java-static Boolean |
@UnstableApiReturns whether the given string is a text MIME type, including known text types that use "application" as their base type. |
java-static Boolean |
@UnstableApiReturns whether the given string is a video MIME type. |
java-static @PolyNull String! |
@UnstableApiNormalizes the MIME type provided so that equivalent MIME types are uniquely represented. |
java-static Unit |
@UnstableApiRegisters a custom MIME type. |
Constants
APPLICATION_CAMERA_MOTION
@UnstableApi
const val APPLICATION_CAMERA_MOTION = "application/x-camera-motion": String!
APPLICATION_DEPTH_METADATA
@UnstableApi
const val APPLICATION_DEPTH_METADATA = "application/x-depth-metadata": String!
APPLICATION_EXTERNALLY_LOADED_IMAGE
@UnstableApi
const val APPLICATION_EXTERNALLY_LOADED_IMAGE = "application/x-image-uri": String!
MIME type for an image URI loaded from an external image management framework.
APPLICATION_MEDIA3_CUES
@UnstableApi
const val APPLICATION_MEDIA3_CUES = "application/x-media3-cues": String!
CODEC_E_AC3_JOC
@UnstableApi
const val CODEC_E_AC3_JOC = "ec+3": String!
A non-standard codec string for E-AC3-JOC. Use of this constant allows for disambiguation between regular E-AC3 ("ec-3") and E-AC3-JOC ("ec+3") streams from the codec string alone. The standard is to use "ec-3" for both, as per the MP4RA registered codec types.
Public functions
allSamplesAreSyncSamples
@UnstableApi
java-static fun allSamplesAreSyncSamples(mimeType: String?, codec: String?): Boolean
Returns true if it is known that all samples in a stream of the given MIME type and codec are guaranteed to be sync samples (i.e., BUFFER_FLAG_KEY_FRAME is guaranteed to be set on every sample) and the inherent duration of each sample is negligible (i.e., we never expect to require a sample because playback partially falls into its duration).
| Parameters | |
|---|---|
mimeType: String? |
The MIME type of the stream. |
codec: String? |
The RFC 6381 codec string of the stream, or |
| Returns | |
|---|---|
Boolean |
Whether it is known that all samples in the stream are guaranteed to be sync samples. |
containsCodecsCorrespondingToMimeType
@UnstableApi
java-static fun containsCodecsCorrespondingToMimeType(codecs: String?, mimeType: String!): Boolean
Returns whether the given codecs string contains a codec which corresponds to the given mimeType.
| Returns | |
|---|---|
Boolean |
Whether the given |
getAudioMediaMimeType
@UnstableApi
java-static fun getAudioMediaMimeType(codecs: String?): String?
Returns the first audio MIME type derived from an RFC 6381 codecs string.
| Parameters | |
|---|---|
codecs: String? |
An RFC 6381 codecs string. |
| Returns | |
|---|---|
String? |
The first derived audio MIME type, or |
getCodecsCorrespondingToMimeType
@UnstableApi
java-static fun getCodecsCorrespondingToMimeType(codecs: String?, mimeType: String?): String?
Returns a subsequence of codecs containing the codec strings that correspond to the given mimeType. Returns null if mimeType is null, codecs is null, or codecs does not contain a codec that corresponds to mimeType.
| Returns | |
|---|---|
String? |
A subsequence of |
getEncoding
@UnstableApi
@C.Encoding
java-static fun getEncoding(mimeType: String!, codec: String?): Int
Returns the C.Encoding constant corresponding to the specified audio MIME type and RFC 6381 codec string, or ENCODING_INVALID if the corresponding C.Encoding cannot be determined.
| Parameters | |
|---|---|
mimeType: String! |
A MIME type. |
codec: String? |
An RFC 6381 codec string, or |
| Returns | |
|---|---|
Int |
The corresponding |
getMediaMimeType
@UnstableApi
java-static fun getMediaMimeType(codec: String?): String?
Returns the MIME type corresponding to an RFC 6381 codec string, or null if it could not be determined.
| Parameters | |
|---|---|
codec: String? |
An RFC 6381 codec string. |
| Returns | |
|---|---|
String? |
The corresponding MIME type, or |
getMimeTypeFromMp4ObjectType
@UnstableApi
java-static fun getMimeTypeFromMp4ObjectType(objectType: Int): String?
Returns the MIME type corresponding to an MP4 object type identifier, as defined in RFC 6381 and https://mp4ra.org/#/object_types.
| Parameters | |
|---|---|
objectType: Int |
An MP4 object type identifier. |
| Returns | |
|---|---|
String? |
The corresponding MIME type, or |
getMp4ObjectTypeFromMimeType
@UnstableApi
java-static fun getMp4ObjectTypeFromMimeType(sampleMimeType: String!): Byte?
Returns the MP4 object type identifier corresponding to a MIME type, as defined in RFC 6381 and MPEG-4 Object Types.
| Parameters | |
|---|---|
sampleMimeType: String! |
The MIME type of the track. |
| Returns | |
|---|---|
Byte? |
The corresponding MP4 object type identifier, or |
getTextMediaMimeType
@UnstableApi
java-static fun getTextMediaMimeType(codecs: String?): String?
Returns the first text MIME type derived from an RFC 6381 codecs string.
| Parameters | |
|---|---|
codecs: String? |
An RFC 6381 codecs string. |
| Returns | |
|---|---|
String? |
The first derived text MIME type, or |
getTrackType
@UnstableApi
@C.TrackType
java-static fun getTrackType(mimeType: String?): Int
Returns the track type constant corresponding to a specified MIME type, which may be TRACK_TYPE_UNKNOWN if it could not be determined.
| Parameters | |
|---|---|
mimeType: String? |
A MIME type. |
| Returns | |
|---|---|
Int |
The corresponding |
getTrackTypeOfCodec
@UnstableApi
@C.TrackType
java-static fun getTrackTypeOfCodec(codec: String!): Int
Equivalent to getTrackType(getMediaMimeType(codec)).
| Parameters | |
|---|---|
codec: String! |
An RFC 6381 codec string. |
| Returns | |
|---|---|
Int |
The corresponding |
getVideoMediaMimeType
@UnstableApi
java-static fun getVideoMediaMimeType(codecs: String?): String?
Returns the first video MIME type derived from an RFC 6381 codecs string.
| Parameters | |
|---|---|
codecs: String? |
An RFC 6381 codecs string. |
| Returns | |
|---|---|
String? |
The first derived video MIME type, or |
isAudio
@UnstableApi
java-static fun isAudio(mimeType: String?): Boolean
Returns whether the given string is an audio MIME type.
isDolbyVisionCodec
@UnstableApi
java-static fun isDolbyVisionCodec(codecs: String?, supplementalCodecs: String?): Boolean
Returns whether the given codecs and supplementalCodecs correspond to a valid Dolby Vision codec.
| Parameters | |
|---|---|
codecs: String? |
An RFC 6381 codecs string for the base codec. may be null. |
supplementalCodecs: String? |
An optional RFC 6381 codecs string for supplemental codecs. |
| Returns | |
|---|---|
Boolean |
Whether the given |
isImage
@UnstableApi
java-static fun isImage(mimeType: String?): Boolean
Returns whether the given string is an image MIME type.
isMatroska
@UnstableApi
java-static fun isMatroska(mimeType: String?): Boolean
Returns whether the given mimeType is a Matroska MIME type, including WebM.
isText
@UnstableApi
@Pure
java-static fun isText(mimeType: String?): Boolean
Returns whether the given string is a text MIME type, including known text types that use "application" as their base type.
isVideo
@UnstableApi
java-static fun isVideo(mimeType: String?): Boolean
Returns whether the given string is a video MIME type.
normalizeMimeType
@UnstableApi
@PolyNull
java-static fun normalizeMimeType(@PolyNull mimeType: @PolyNull String!): @PolyNull String!
Normalizes the MIME type provided so that equivalent MIME types are uniquely represented.
registerCustomMimeType
@UnstableApi
java-static fun registerCustomMimeType(
mimeType: String!,
codecPrefix: String!,
@C.TrackType trackType: Int
): Unit
Registers a custom MIME type. Most applications do not need to call this method, as handling of standard MIME types is built in. These built-in MIME types take precedence over any registered via this method. If this method is used, it must be called before creating any player(s).
| Parameters | |
|---|---|
mimeType: String! |
The custom MIME type to register. |
codecPrefix: String! |
The RFC 6381 codec string prefix associated with the MIME type. |
@C.TrackType trackType: Int |
The |