Class: shaka.util.MimeUtils

A set of utility functions for dealing with MIME types.

Constructor

new MimeUtils()

A set of utility functions for dealing with MIME types.

Source:

Members

CEA608_CLOSED_CAPTION_MIMETYPE :string

A mimetype created for CEA-608 closed captions.
Type:
  • string
Source:

CEA708_CLOSED_CAPTION_MIMETYPE :string

A mimetype created for CEA-708 closed captions.
Type:
  • string
Source:

EXTENDED_MIME_PARAMETERS_ :Map.<string, string>

A map from Stream object keys to MIME type parameters. These should be ignored by platforms that do not recognize them. This initial set of parameters are all recognized by Chromecast.
Type:
  • Map.<string, string>
Source:

RAW_FORMATS :Array.<string>

MIME types of raw formats.
Type:
  • Array.<string>
Source:

Methods

getBasicType(mimeType) → {string}

Takes a full MIME type (with codecs) or basic MIME type (without codecs) and returns a basic MIME type (without codecs or other parameters).
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
string

getCodecBase(codecString) → {string}

Get the base codec from a codec string.
Parameters:
Name Type Description
codecString string
Source:
Returns:
Type
string

getCodecParts_(codecString) → {Array.<string>}

Get the base and profile of a codec string. Where [0] will be the codec base and [1] will be the profile.
Parameters:
Name Type Description
codecString string
Source:
Returns:
Type
Array.<string>

getCodecs(mimeType) → {string}

Takes a MIME type and returns the codecs parameter, or an empty string if there is no codecs parameter.
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
string

getContainerType(mimeType) → {string}

Takes a full MIME type (with codecs) or basic MIME type (without codecs) and returns a container type string ("mp2t", "mp4", "webm", etc.)
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
string

getExtendedType(stream, mimeType, codecs) → {string}

Takes a Stream object and produces an extended MIME type with information beyond the container and codec type, when available.
Parameters:
Name Type Description
stream shaka.extern.Stream
mimeType string
codecs string
Source:
Returns:
Type
string

getFullOrConvertedType(mimeType, codecs, contentType) → {string}

Takes a MIME type and a codecs string and produces the full MIME type. If it's a transport stream, convert its codecs to MP4 codecs. Otherwise for multiplexed content, convert the video MIME types to their audio equivalents if the content type is audio.
Parameters:
Name Type Description
mimeType string
codecs string
contentType string
Source:
Returns:
Type
string

getFullType(mimeType, codecsopt) → {string}

Takes a MIME type and optional codecs string and produces the full MIME type. Also remove the codecs for raw formats.
Parameters:
Name Type Attributes Description
mimeType string
codecs string <optional>
Source:
Returns:
Type
string

getFullTypeWithAllCodecs(mimeType, codecsopt) → {string}

Takes a MIME type and optional codecs string and produces the full MIME type.
Parameters:
Name Type Attributes Description
mimeType string
codecs string <optional>
Source:
Returns:
Type
string

getNormalizedCodec(codecString) → {string}

Get the normalized codec from a codec string, independently of their container.
Parameters:
Name Type Description
codecString string
Source:
Returns:
Type
string

isHlsType(mimeType) → {boolean}

Checks if the given MIME type is HLS MIME type.
Parameters:
Name Type Description
mimeType string
Source:
Returns:
Type
boolean

splitCodecs(codecs) → {Array.<string>}

Split a list of codecs encoded in a string into a list of codecs.
Parameters:
Name Type Description
codecs string
Source:
Returns:
Type
Array.<string>