class MimeTypes


Defines common MIME types and helper methods.

Summary

Constants

const String!
APPLICATION_AIT = "application/vnd.dvb.ait"
const String!
@UnstableApi
APPLICATION_CAMERA_MOTION = "application/x-camera-motion"
const String!
APPLICATION_CEA608 = "application/cea-608"
const String!
APPLICATION_CEA708 = "application/cea-708"
const String!
@UnstableApi
APPLICATION_DEPTH_METADATA = "application/x-depth-metadata"
const String!
APPLICATION_DVBSUBS = "application/dvbsubs"
const String!
@UnstableApi
APPLICATION_EMSG = "application/x-emsg"
const String!
@UnstableApi
APPLICATION_EXIF = "application/x-exif"
const String!

MIME type for an image URI loaded from an external image management framework.

const String!
@UnstableApi
APPLICATION_ICY = "application/x-icy"
const String!
APPLICATION_ID3 = "application/id3"
const String!
APPLICATION_M3U8 = "application/x-mpegURL"
const String!
APPLICATION_MATROSKA = "application/x-matroska"
const String!
@UnstableApi
APPLICATION_MEDIA3_CUES = "application/x-media3-cues"
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
APPLICATION_SCTE35 = "application/x-scte35"
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
AUDIO_DTS_X = "audio/vnd.dts.uhd;profile=p2"
const String!
@UnstableApi
AUDIO_EXOPLAYER_MIDI = "audio/x-exoplayer-midi"
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
AUDIO_IAMF = "audio/iamf"
const String!
@UnstableApi
AUDIO_MATROSKA = "audio/x-matroska"
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
AUDIO_UNKNOWN = "audio/x-unknown"
const String!
AUDIO_VORBIS = "audio/vorbis"
const String!
AUDIO_WAV = "audio/wav"
const String!
AUDIO_WEBM = "audio/webm"
const String!
const String!
const String!
const String!
const String!
const String!

A non-standard codec string for E-AC3-JOC.

const String!
@UnstableApi
IMAGE_AVIF = "image/avif"
const String!
@UnstableApi
IMAGE_BMP = "image/bmp"
const String!
@UnstableApi
IMAGE_HEIC = "image/heic"
const String!
@UnstableApi
IMAGE_HEIF = "image/heif"
const String!
IMAGE_JPEG = "image/jpeg"
const String!
@UnstableApi
IMAGE_JPEG_R = "image/jpeg_r"
const String!
@UnstableApi
IMAGE_PNG = "image/png"
const String!
@UnstableApi
IMAGE_RAW = "image/raw"
const String!
@UnstableApi
IMAGE_WEBP = "image/webp"
const String!
TEXT_SSA = "text/x-ssa"
const String!
@UnstableApi
TEXT_UNKNOWN = "text/x-unknown"
const String!
TEXT_VTT = "text/vtt"
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
VIDEO_FLV = "video/x-flv"
const String!
VIDEO_H263 = "video/3gpp"
const String!
VIDEO_H264 = "video/avc"
const String!
VIDEO_H265 = "video/hevc"
const String!
@UnstableApi
VIDEO_MATROSKA = "video/x-matroska"
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
VIDEO_MV_HEVC = "video/mv-hevc"
const String!
VIDEO_OGG = "video/ogg"
const String!
VIDEO_PS = "video/mp2p"
const String!
@UnstableApi
VIDEO_RAW = "video/raw"
const String!
@UnstableApi
VIDEO_UNKNOWN = "video/x-unknown"
const String!
VIDEO_VC1 = "video/wvc1"
const String!
@UnstableApi
VIDEO_VP8 = "video/x-vnd.on2.vp8"
const String!
@UnstableApi
VIDEO_VP9 = "video/x-vnd.on2.vp9"
const String!
VIDEO_WEBM = "video/webm"

Public functions

java-static 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).

java-static Boolean

Returns whether the given codecs string contains a codec which corresponds to the given mimeType.

java-static String?

Returns the first audio MIME type derived from an RFC 6381 codecs string.

java-static String?

Returns a subsequence of codecs containing the codec strings that correspond to the given mimeType.

java-static 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.

java-static String?

Returns the MIME type corresponding to an RFC 6381 codec string, or null if it could not be determined.

java-static String?

Returns the MIME type corresponding to an MP4 object type identifier, as defined in RFC 6381 and https://mp4ra.org/#/object_types.

java-static Byte?

Returns the MP4 object type identifier corresponding to a MIME type, as defined in RFC 6381 and MPEG-4 Object Types.

java-static String?

Returns the first text MIME type derived from an RFC 6381 codecs string.

java-static Int

Returns the track type constant corresponding to a specified MIME type, which may be TRACK_TYPE_UNKNOWN if it could not be determined.

java-static Int

Equivalent to getTrackType(getMediaMimeType(codec)).

java-static String?

Returns the first video MIME type derived from an RFC 6381 codecs string.

java-static Boolean

Returns whether the given string is an audio MIME type.

java-static Boolean

Returns whether the given string is an image MIME type.

java-static Boolean

Returns whether the given mimeType is a Matroska MIME type, including WebM.

java-static Boolean

Returns whether the given string is a text MIME type, including known text types that use "application" as their base type.

java-static Boolean

Returns whether the given string is a video MIME type.

java-static @PolyNull String!

Normalizes the MIME type provided so that equivalent MIME types are uniquely represented.

java-static Unit
@UnstableApi
registerCustomMimeType(
    mimeType: String!,
    codecPrefix: String!,
    @C.TrackType trackType: Int
)

Registers a custom MIME type.

Constants

APPLICATION_AIT

const val APPLICATION_AIT = "application/vnd.dvb.ait": String!

APPLICATION_CAMERA_MOTION

@UnstableApi
const val APPLICATION_CAMERA_MOTION = "application/x-camera-motion": String!

APPLICATION_CEA608

const val APPLICATION_CEA608 = "application/cea-608": String!

APPLICATION_CEA708

const val APPLICATION_CEA708 = "application/cea-708": String!

APPLICATION_DEPTH_METADATA

@UnstableApi
const val APPLICATION_DEPTH_METADATA = "application/x-depth-metadata": String!

APPLICATION_DVBSUBS

const val APPLICATION_DVBSUBS = "application/dvbsubs": String!

APPLICATION_EMSG

@UnstableApi
const val APPLICATION_EMSG = "application/x-emsg": String!

APPLICATION_EXIF

@UnstableApi
const val APPLICATION_EXIF = "application/x-exif": 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_ICY

@UnstableApi
const val APPLICATION_ICY = "application/x-icy": String!

APPLICATION_ID3

const val APPLICATION_ID3 = "application/id3": String!

APPLICATION_M3U8

const val APPLICATION_M3U8 = "application/x-mpegURL": String!

APPLICATION_MATROSKA

const val APPLICATION_MATROSKA = "application/x-matroska": String!

APPLICATION_MEDIA3_CUES

@UnstableApi
const val APPLICATION_MEDIA3_CUES = "application/x-media3-cues": String!

APPLICATION_MP4

const val APPLICATION_MP4 = "application/mp4": String!

APPLICATION_MP4CEA608

const val APPLICATION_MP4CEA608 = "application/x-mp4-cea-608": String!

APPLICATION_MP4VTT

const val APPLICATION_MP4VTT = "application/x-mp4-vtt": String!

APPLICATION_MPD

const val APPLICATION_MPD = "application/dash+xml": String!

APPLICATION_PGS

const val APPLICATION_PGS = "application/pgs": String!

APPLICATION_RAWCC

const val APPLICATION_RAWCC = "application/x-rawcc": String!

APPLICATION_RTSP

const val APPLICATION_RTSP = "application/x-rtsp": String!

APPLICATION_SCTE35

@UnstableApi
const val APPLICATION_SCTE35 = "application/x-scte35": String!

APPLICATION_SDP

const val APPLICATION_SDP = "application/sdp": String!

APPLICATION_SS

const val APPLICATION_SS = "application/vnd.ms-sstr+xml": String!

APPLICATION_SUBRIP

const val APPLICATION_SUBRIP = "application/x-subrip": String!

APPLICATION_TTML

const val APPLICATION_TTML = "application/ttml+xml": String!

APPLICATION_TX3G

const val APPLICATION_TX3G = "application/x-quicktime-tx3g": String!

APPLICATION_VOBSUB

const val APPLICATION_VOBSUB = "application/vobsub": String!

APPLICATION_WEBM

const val APPLICATION_WEBM = "application/webm": String!

AUDIO_AAC

const val AUDIO_AAC = "audio/mp4a-latm": String!

AUDIO_AC3

const val AUDIO_AC3 = "audio/ac3": String!

AUDIO_AC4

const val AUDIO_AC4 = "audio/ac4": String!

AUDIO_ALAC

const val AUDIO_ALAC = "audio/alac": String!

AUDIO_ALAW

const val AUDIO_ALAW = "audio/g711-alaw": String!

AUDIO_AMR

const val AUDIO_AMR = "audio/amr": String!

AUDIO_AMR_NB

const val AUDIO_AMR_NB = "audio/3gpp": String!

AUDIO_AMR_WB

const val AUDIO_AMR_WB = "audio/amr-wb": String!

AUDIO_DTS

const val AUDIO_DTS = "audio/vnd.dts": String!

AUDIO_DTS_EXPRESS

const val AUDIO_DTS_EXPRESS = "audio/vnd.dts.hd;profile=lbr": String!

AUDIO_DTS_HD

const val AUDIO_DTS_HD = "audio/vnd.dts.hd": String!

AUDIO_DTS_X

@UnstableApi
const val AUDIO_DTS_X = "audio/vnd.dts.uhd;profile=p2": String!

AUDIO_EXOPLAYER_MIDI

@UnstableApi
const val AUDIO_EXOPLAYER_MIDI = "audio/x-exoplayer-midi": String!

AUDIO_E_AC3

const val AUDIO_E_AC3 = "audio/eac3": String!

AUDIO_E_AC3_JOC

const val AUDIO_E_AC3_JOC = "audio/eac3-joc": String!

AUDIO_FLAC

const val AUDIO_FLAC = "audio/flac": String!

AUDIO_IAMF

@UnstableApi
const val AUDIO_IAMF = "audio/iamf": String!

AUDIO_MATROSKA

@UnstableApi
const val AUDIO_MATROSKA = "audio/x-matroska": String!

AUDIO_MIDI

const val AUDIO_MIDI = "audio/midi": String!

AUDIO_MLAW

const val AUDIO_MLAW = "audio/g711-mlaw": String!

AUDIO_MP4

const val AUDIO_MP4 = "audio/mp4": String!

AUDIO_MPEG

const val AUDIO_MPEG = "audio/mpeg": String!

AUDIO_MPEGH_MHA1

const val AUDIO_MPEGH_MHA1 = "audio/mha1": String!

AUDIO_MPEGH_MHM1

const val AUDIO_MPEGH_MHM1 = "audio/mhm1": String!

AUDIO_MPEG_L1

const val AUDIO_MPEG_L1 = "audio/mpeg-L1": String!

AUDIO_MPEG_L2

const val AUDIO_MPEG_L2 = "audio/mpeg-L2": String!

AUDIO_MSGSM

const val AUDIO_MSGSM = "audio/gsm": String!

AUDIO_OGG

const val AUDIO_OGG = "audio/ogg": String!

AUDIO_OPUS

const val AUDIO_OPUS = "audio/opus": String!

AUDIO_RAW

const val AUDIO_RAW = "audio/raw": String!

AUDIO_TRUEHD

const val AUDIO_TRUEHD = "audio/true-hd": String!

AUDIO_UNKNOWN

@UnstableApi
const val AUDIO_UNKNOWN = "audio/x-unknown": String!

AUDIO_VORBIS

const val AUDIO_VORBIS = "audio/vorbis": String!

AUDIO_WAV

const val AUDIO_WAV = "audio/wav": String!

AUDIO_WEBM

const val AUDIO_WEBM = "audio/webm": String!

BASE_TYPE_APPLICATION

@UnstableApi
const val BASE_TYPE_APPLICATION = "application": String!

BASE_TYPE_AUDIO

@UnstableApi
const val BASE_TYPE_AUDIO = "audio": String!

BASE_TYPE_IMAGE

@UnstableApi
const val BASE_TYPE_IMAGE = "image": String!

BASE_TYPE_TEXT

@UnstableApi
const val BASE_TYPE_TEXT = "text": String!

BASE_TYPE_VIDEO

@UnstableApi
const val BASE_TYPE_VIDEO = "video": 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.

IMAGE_AVIF

@UnstableApi
const val IMAGE_AVIF = "image/avif": String!

IMAGE_BMP

@UnstableApi
const val IMAGE_BMP = "image/bmp": String!

IMAGE_HEIC

@UnstableApi
const val IMAGE_HEIC = "image/heic": String!

IMAGE_HEIF

@UnstableApi
const val IMAGE_HEIF = "image/heif": String!

IMAGE_JPEG

const val IMAGE_JPEG = "image/jpeg": String!

IMAGE_JPEG_R

@UnstableApi
const val IMAGE_JPEG_R = "image/jpeg_r": String!

IMAGE_PNG

@UnstableApi
const val IMAGE_PNG = "image/png": String!

IMAGE_RAW

@UnstableApi
const val IMAGE_RAW = "image/raw": String!

IMAGE_WEBP

@UnstableApi
const val IMAGE_WEBP = "image/webp": String!

TEXT_SSA

const val TEXT_SSA = "text/x-ssa": String!

TEXT_UNKNOWN

@UnstableApi
const val TEXT_UNKNOWN = "text/x-unknown": String!

TEXT_VTT

const val TEXT_VTT = "text/vtt": String!

VIDEO_AV1

const val VIDEO_AV1 = "video/av01": String!

VIDEO_AVI

const val VIDEO_AVI = "video/x-msvideo": String!

VIDEO_DIVX

const val VIDEO_DIVX = "video/divx": String!

VIDEO_DOLBY_VISION

const val VIDEO_DOLBY_VISION = "video/dolby-vision": String!

VIDEO_FLV

@UnstableApi
const val VIDEO_FLV = "video/x-flv": String!

VIDEO_H263

const val VIDEO_H263 = "video/3gpp": String!

VIDEO_H264

const val VIDEO_H264 = "video/avc": String!

VIDEO_H265

const val VIDEO_H265 = "video/hevc": String!

VIDEO_MATROSKA

@UnstableApi
const val VIDEO_MATROSKA = "video/x-matroska": String!

VIDEO_MJPEG

const val VIDEO_MJPEG = "video/mjpeg": String!

VIDEO_MP2T

const val VIDEO_MP2T = "video/mp2t": String!

VIDEO_MP4

const val VIDEO_MP4 = "video/mp4": String!

VIDEO_MP42

const val VIDEO_MP42 = "video/mp42": String!

VIDEO_MP43

const val VIDEO_MP43 = "video/mp43": String!

VIDEO_MP4V

const val VIDEO_MP4V = "video/mp4v-es": String!

VIDEO_MPEG

const val VIDEO_MPEG = "video/mpeg": String!

VIDEO_MPEG2

const val VIDEO_MPEG2 = "video/mpeg2": String!

VIDEO_MV_HEVC

@UnstableApi
const val VIDEO_MV_HEVC = "video/mv-hevc": String!

VIDEO_OGG

const val VIDEO_OGG = "video/ogg": String!

VIDEO_PS

const val VIDEO_PS = "video/mp2p": String!

VIDEO_RAW

@UnstableApi
const val VIDEO_RAW = "video/raw": String!

VIDEO_UNKNOWN

@UnstableApi
const val VIDEO_UNKNOWN = "video/x-unknown": String!

VIDEO_VC1

const val VIDEO_VC1 = "video/wvc1": String!

VIDEO_VP8

@UnstableApi
const val VIDEO_VP8 = "video/x-vnd.on2.vp8": String!

VIDEO_VP9

@UnstableApi
const val VIDEO_VP9 = "video/x-vnd.on2.vp9": String!

VIDEO_WEBM

const val VIDEO_WEBM = "video/webm": String!

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 null if unknown.

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.

Parameters
codecs: String?

An RFC 6381 codecs string.

mimeType: String!

A MIME type to look for.

Returns
Boolean

Whether the given codecs string contains a codec which corresponds to the given mimeType.

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 null.

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.

Parameters
codecs: String?

An RFC 6381 codecs string.

mimeType: String?

A MIME type to look for.

Returns
String?

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.

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 null if unknown or not applicable.

Returns
Int

The corresponding C.Encoding, or ENCODING_INVALID.

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 null if it could not be determined.

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 null if it could not be determined.

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 null if it could not be determined.

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 null.

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 track type, which may be TRACK_TYPE_UNKNOWN if it could not be determined.

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 track type, which may be TRACK_TYPE_UNKNOWN if it could not be determined.

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 null.

isAudio

@UnstableApi
java-static fun isAudio(mimeType: String?): Boolean

Returns whether the given string is an audio MIME type.

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.

Parameters
@PolyNull mimeType: @PolyNull String!

A MIME type to normalize, or null.

Returns
@PolyNull String!

The normalized MIME type, or the argument MIME type if its normalized form is unknown.

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 track type associated with the MIME type. This value is ignored if the top-level type of mimeType is audio, video or text.