Class: shaka.hls.HlsParser

Constructor

new HlsParser()

Creates an Hls Parser object.
Implements:
Source:

Members

AUDIO_EXTENSIONS_TO_MIME_TYPES_ :Object.<string, string>

Type:
  • Object.<string, string>
Source:

EXTENSION_MAP_BY_CONTENT_TYPE_ :Object.<string, !Object.<string, string>>

Type:
  • Object.<string, !Object.<string, string>>
Source:

FAKE_MUXED_URL_ :string

Type:
  • string
Source:

IMAGE_EXTENSIONS_TO_MIME_TYPES_ :Object.<string, string>

Type:
  • Object.<string, string>
Source:

KEYFORMATS_TO_DRM_PARSERS_ :Object.<string, shaka.hls.HlsParser.DrmParser_>

Type:
Source:

MIME_TYPES_WITHOUT_INIT_SEGMENT_ :Set.<string>

MIME types without init segment.
Type:
  • Set.<string>
Source:

PresentationType_ :string

Type:
  • string
Properties:
Name Value Type Description
VOD VOD string
EVENT EVENT string
LIVE LIVE string
Source:

RAW_FORMATS_TO_MIME_TYPES_ :Object.<string, string>

Type:
  • Object.<string, string>
Source:

TEXT_EXTENSIONS_TO_MIME_TYPES_ :Object.<string, string>

Type:
  • Object.<string, string>
Source:

VIDEO_EXTENSIONS_TO_MIME_TYPES_ :Object.<string, string>

Type:
  • Object.<string, string>
Source:

aesKeyInfoMap_ :Map.<string, !shaka.extern.aesKey>

Type:
Source:

aesKeyMap_ :Map.<string, !Promise.<shaka.extern.Response>>

Type:
Source:

averageUpdateDuration_ :shaka.abr.Ewma

An ewma that tracks how long updates take. This is to mitigate issues caused by slow parsing on embedded devices.
Type:
Source:

codecInfoInManifest_

Whether the manifest informs about the codec to use.
Source:

dateRangeIdsEmitted_ :Set.<string>

Type:
  • Set.<string>
Source:

globalId_ :number

Type:
  • number
Source:

globalVariables_ :Map.<string, string>

Type:
  • Map.<string, string>
Source:

groupIdToClosedCaptionsMap_ :Map.<string, Map.<string, string>>

A map from closed captions' group id, to a map of closed captions info. {group id -> {closed captions channel id -> language}}
Type:
  • Map.<string, Map.<string, string>>
Source:

groupIdToCodecsMap_ :Map.<string, string>

Type:
  • Map.<string, string>
Source:

groupIdToStreamInfosMap_ :Map.<string, !Array.<?shaka.hls.HlsParser.StreamInfo>>

A map from group id to stream infos created from the media tags.
Type:
Source:

identityKeyMap_ :Map.<string, !Promise.<shaka.extern.Response>>

Type:
Source:

identityKidMap_ :Map.<!shaka.media.InitSegmentReference, ?string>

Type:
Source:

lastTargetDuration_ :number

Type:
  • number
Source:

lowestSyncTime_ :number

The lowest time value for any of the streams, as defined by the EXT-X-PROGRAM-DATE-TIME value. Measured in seconds since January 1, 1970.
Type:
  • number
Source:

lowLatencyByterangeOptimization_ :boolean

Type:
  • boolean
Source:

lowLatencyMode_ :boolean

Type:
  • boolean
Source:

lowLatencyPresentationDelay_ :number

Type:
  • number
Source:

mapTagToInitSegmentRefMap_

A cache mapping EXT-X-MAP tag info to the InitSegmentReference created from the tag. The key is a string combining the EXT-X-MAP tag's absolute uri, and its BYTERANGE if available. {!Map.}
Source:

masterPlaylistUri_ :string

The master playlist URI, after redirects.
Type:
  • string
Source:

maxTargetDuration_ :number

Type:
  • number
Source:

mediaSequenceToStartTimeByType_ :Map.<string, !Map.<number, number>>

For media playlist lazy-loading to work in livestreams, we have to assume that each stream of a type (video, audio, etc) has the same mappings of sequence number to start time. This map stores those relationships. Only used during livestreams; we do not assume that VOD content is aligned in that way.
Type:
  • Map.<string, !Map.<number, number>>
Source:

minSequenceNumber_ :number

The minimum sequence number for generated segments, when ignoring EXT-X-PROGRAM-DATE-TIME.
Type:
  • number
Source:

needsClosedCaptionsDetection_ :boolean

Type:
  • boolean
Source:

partialTargetDuration_ :number

Partial segments target duration.
Type:
  • number
Source:

presentationDelay_ :number

Type:
  • number
Source:

startTime_ :number

Type:
  • number
Source:

streamsFinalized_ :boolean

Whether the streams have previously been "finalized"; that is to say, whether we have loaded enough streams to know information about the asset such as timing information, live status, etc.
Type:
  • boolean
Source:

updatePlaylistTimer_ :shaka.util.Timer

This timer is used to trigger the start of a manifest update. A manifest update is async. Once the update is finished, the timer will be restarted to trigger the next update. The timer will only be started if the content is live content.
Type:
Source:

uriToStreamInfosMap_ :Map.<string, shaka.hls.HlsParser.StreamInfo>

A map from (verbatim) media playlist URI to stream infos representing the playlists. On update, used to iterate through and update from media playlists. On initial parse, used to iterate through and determine minimum timestamps, offsets, and to handle TS rollover. During parsing, used to avoid duplicates in the async methods createStreamInfoFromMediaTags_, createStreamInfoFromImageTag_ and createStreamInfoFromVariantTags_.
Type:
Source:

usesProgramDateTime_ :boolean

Flag to indicate if any of the media playlists use EXT-X-PROGRAM-DATE-TIME.
Type:
  • boolean
Source:

variantUriSet_ :Set.<string>

The values are strings of the form "
Type:
  • Set.<string>
Source:

Methods

fairplayDrmParser_(drmTagnon-null, mimeType) → {shaka.extern.DrmInfo}

Parameters:
Name Type Description
drmTag shaka.hls.Tag
mimeType string
Source:
Returns:
Type
shaka.extern.DrmInfo

playreadyDrmParser_(drmTagnon-null) → {shaka.extern.DrmInfo}

See: https://docs.microsoft.com/en-us/playready/packaging/mp4-based-formats-supported-by-playready-clients?tabs=case4
Parameters:
Name Type Description
drmTag shaka.hls.Tag
Source:
Returns:
Type
shaka.extern.DrmInfo

widevineDrmParser_(drmTagnon-null) → {shaka.extern.DrmInfo}

Parameters:
Name Type Description
drmTag shaka.hls.Tag
Source:
Returns:
Type
shaka.extern.DrmInfo

addVideoAttributes_(stream, widthnullable, heightnullable, frameRatenullable, videoRangenullable, videoLayoutnullable, colorGamutnullable)

Parameters:
Name Type Attributes Description
stream shaka.extern.Stream
width string <nullable>
height string <nullable>
frameRate string <nullable>
videoRange string <nullable>
videoLayout string <nullable>
colorGamut string <nullable>
Source:

banLocation(uri)

Tells the parser that a location should be banned. This is called on retry.
Parameters:
Name Type Description
uri string
Implements:
Source:

changePresentationTimelineToLive_(playlistnon-null)

Parameters:
Name Type Description
playlist shaka.hls.Playlist
Source:

configure(config, isPreloadFnopt)

Called by the Player to provide an updated configuration any time the configuration changes. Will be called at least once before start().
Parameters:
Name Type Attributes Description
config shaka.extern.ManifestConfiguration
isPreloadFn function <optional>
Implements:
Source:

convertParsedPlaylistIntoStreamInfo_(streamId, playlistnon-null, getUris, responseUri, codecs, type, languageValuenullable, primary, namenullable, channelsCountnullable, closedCaptions, characteristicsnullable, forced, sampleRatenullable, spatialAudio, mimeType, requestBasicInfoopt, allowOverrideMimeTypeopt) → {Promise.<!shaka.hls.HlsParser.StreamInfo>}

Parameters:
Name Type Attributes Default Description
streamId number
playlist shaka.hls.Playlist
getUris function(): !Array.<string>
responseUri string
codecs string
type string
languageValue string <nullable>
primary boolean
name string <nullable>
channelsCount number <nullable>
closedCaptions Map.<string, string>
characteristics string <nullable>
forced boolean
sampleRate number <nullable>
spatialAudio boolean
mimeType string | undefined
requestBasicInfo boolean <optional>
true
allowOverrideMimeType boolean <optional>
true
Source:
Returns:
Type
Promise.<!shaka.hls.HlsParser.StreamInfo>

createInitSegmentReference_(absoluteInitSegmentUrisnon-null, mapTagnon-null, byteRangeTagopt, aesKeyopt) → {shaka.media.InitSegmentReference}

Create an InitSegmentReference object for the EXT-X-MAP tag in the media playlist.
Parameters:
Name Type Attributes Description
absoluteInitSegmentUris Array.<string>
mapTag shaka.hls.Tag EXT-X-MAP
byteRangeTag shaka.hls.Tag <optional>
EXT-X-BYTERANGE
aesKey shaka.extern.aesKey <optional>
Source:
Returns:
Type
shaka.media.InitSegmentReference

createSegmentReference_(initSegmentReference, previousReference, hlsSegmentnon-null, startTime, variablesnon-null, playlistnon-null, type, getUris, aesKeyopt) → {shaka.media.SegmentReference}

Parses one shaka.hls.Segment object into a shaka.media.SegmentReference.
Parameters:
Name Type Attributes Description
initSegmentReference shaka.media.InitSegmentReference
previousReference shaka.media.SegmentReference
hlsSegment shaka.hls.Segment
startTime number
variables Map.<string, string>
playlist shaka.hls.Playlist
type string
getUris function(): !Array.<string>
aesKey shaka.extern.aesKey <optional>
Source:
Returns:
Type
shaka.media.SegmentReference

createSegments_(playlistnon-null, mediaSequenceToStartTimenon-null, variablesnon-null, getUris, type) → {{segments: !Array.<!shaka.media.SegmentReference>, bandwidth: (number|undefined)}}

Parses shaka.hls.Segment objects into shaka.media.SegmentReferences and get the bandwidth necessary for this segments If it's defined in the playlist.
Parameters:
Name Type Description
playlist shaka.hls.Playlist
mediaSequenceToStartTime Map.<number, number>
variables Map.<string, string>
getUris function(): !Array.<string>
type string
Source:
Returns:
Type
{segments: !Array.<!shaka.media.SegmentReference>, bandwidth: (number|undefined)}

createStreamInfo_(streamId, verbatimMediaPlaylistUrisnon-null, codecs, type, languageValuenullable, primary, namenullable, channelsCountnullable, closedCaptions, characteristicsnullable, forced, sampleRatenullable, spatialAudio) → {shaka.hls.HlsParser.StreamInfo}

Parameters:
Name Type Attributes Description
streamId number
verbatimMediaPlaylistUris Array.<string>
codecs string
type string
languageValue string <nullable>
primary boolean
name string <nullable>
channelsCount number <nullable>
closedCaptions Map.<string, string>
characteristics string <nullable>
forced boolean
sampleRate number <nullable>
spatialAudio boolean
Source:
Returns:
Type
shaka.hls.HlsParser.StreamInfo

createStreamInfoFromIframeTag_(tag) → {shaka.hls.HlsParser.StreamInfo}

Parse EXT-X-I-FRAME-STREAM-INF media tag into a Stream object.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
Type
shaka.hls.HlsParser.StreamInfo

createStreamInfoFromImageTag_(tag) → {Promise.<!shaka.hls.HlsParser.StreamInfo>}

Parse EXT-X-IMAGE-STREAM-INF media tag into a Stream object.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
Type
Promise.<!shaka.hls.HlsParser.StreamInfo>

createStreamInfoFromMediaTags_(tagsnon-null, groupIdPathwayIdMappingnon-null, requireUriopt) → {shaka.hls.HlsParser.StreamInfo}

Parse EXT-X-MEDIA media tag into a Stream object.
Parameters:
Name Type Attributes Default Description
tags Array.<!shaka.hls.Tag>
groupIdPathwayIdMapping Map.<string, string>
requireUri boolean <optional>
true
Source:
Returns:
Type
shaka.hls.HlsParser.StreamInfo

createStreamInfoFromVariantTags_(tagsnon-null, allCodecsnon-null, type) → {shaka.hls.HlsParser.StreamInfo}

Parse an EXT-X-STREAM-INF media tag into a Stream object.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag>
allCodecs Array.<string>
type string
Source:
Returns:
Type
shaka.hls.HlsParser.StreamInfo

createStreamInfosForVariantTags_(tagsnon-null, mediaTagsnon-null, resolutionnullable, frameRatenullable) → {shaka.hls.HlsParser.StreamInfos}

Create audio and video streamInfos from an 'EXT-X-STREAM-INF' tag and its related media tags.
Parameters:
Name Type Attributes Description
tags Array.<!shaka.hls.Tag>
mediaTags Array.<!shaka.hls.Tag>
resolution string <nullable>
frameRate string <nullable>
Source:
Returns:
Type
shaka.hls.HlsParser.StreamInfos

createStreamInfosFromMediaTags_(mediaTagsnon-null, groupIdPathwayIdMappingnon-null)

Parameters:
Name Type Description
mediaTags Array.<!shaka.hls.Tag> Media tags from the playlist.
groupIdPathwayIdMapping Map.<string, string>
Source:

createVariants_(audioInfosnon-null, videoInfosnon-null, bandwidth, widthnullable, heightnullable, frameRatenullable, videoRangenullable, videoLayoutnullable, drmInfosnon-null, keyIdsnon-null, iFrameStreamsnon-null) → {Array.<!shaka.extern.Variant>}

Parameters:
Name Type Attributes Description
audioInfos Array.<shaka.hls.HlsParser.StreamInfo>
videoInfos Array.<shaka.hls.HlsParser.StreamInfo>
bandwidth number
width string <nullable>
height string <nullable>
frameRate string <nullable>
videoRange string <nullable>
videoLayout string <nullable>
drmInfos Array.<shaka.extern.DrmInfo>
keyIds Set.<string>
iFrameStreams Array.<!shaka.extern.Stream>
Source:
Returns:
Type
Array.<!shaka.extern.Variant>

createVariantsForTags_(tagsnon-null, sessionKeyTagsnon-null, mediaTagsnon-null, getUris, variablesnullable, iFrameStreamsnon-null) → {Promise.<!Array.<!shaka.extern.Variant>>}

Parameters:
Name Type Attributes Description
tags Array.<!shaka.hls.Tag> Variant tags from the playlist.
sessionKeyTags Array.<!shaka.hls.Tag> EXT-X-SESSION-KEY tags from the playlist.
mediaTags Array.<!shaka.hls.Tag> EXT-X-MEDIA tags from the playlist.
getUris function(): !Array.<string>
variables Map.<string, string> <nullable>
iFrameStreams Array.<!shaka.extern.Stream>
Source:
Returns:
Type
Promise.<!Array.<!shaka.extern.Variant>>

determineDuration_()

Source:

determineLastTargetDuration_(playlistnon-null)

Parameters:
Name Type Description
playlist shaka.hls.Playlist
Source:

determinePresentationType_(playlistnon-null)

Parameters:
Name Type Description
playlist shaka.hls.Playlist
Source:

determineStartTime_(playlistnon-null)

Parameters:
Name Type Description
playlist shaka.hls.Playlist
Source:

finalizeStreams_(streamInfosnon-null)

Parameters:
Name Type Description
streamInfos Array.<!shaka.hls.HlsParser.StreamInfo>
Source:

getAvailableSegment_(segmentsnon-null) → {{segment: !shaka.media.SegmentReference, segmentIndex: number}}

Parameters:
Name Type Description
segments Array.<!shaka.media.SegmentReference>
Source:
Returns:
Type
{segment: !shaka.media.SegmentReference, segmentIndex: number}

getBasicInfoFromSegments_(segmentsnon-null) → {Promise.<shaka.media.SegmentUtils.BasicInfo>}

Parameters:
Name Type Description
segments Array.<!shaka.media.SegmentReference>
Source:
Returns:
Type
Promise.<shaka.media.SegmentUtils.BasicInfo>

getChannelsCount_(tagnon-null) → {number}

Get the channel count information for an HLS audio track. CHANNELS specifies an ordered, "/" separated list of parameters. If the type is audio, the first parameter will be a decimal integer specifying the number of independent, simultaneous audio channels. No other channels parameters are currently defined.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
Type
number

getClosedCaptions_(tagnon-null, type) → {Map.<string, string>}

Get the closed captions map information for the EXT-X-STREAM-INF tag, to create the stream info.
Parameters:
Name Type Description
tag shaka.hls.Tag
type string
Source:
Returns:
closedCaptions
Type
Map.<string, string>

getCodecsForVariantTag_(tagnon-null) → {Array.<string>}

Get the codecs from the 'EXT-X-STREAM-INF' tag.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
codecs
Type
Array.<string>

getInitSegmentReference_(playlistnon-null, tagsnon-null, getUris, variablesopt, nullable) → {shaka.media.InitSegmentReference}

Get the InitSegmentReference for a segment if it has a EXT-X-MAP tag.
Parameters:
Name Type Attributes Description
playlist shaka.hls.Playlist
tags Array.<!shaka.hls.Tag> Segment tags
getUris function(): !Array.<string>
variables Map.<string, string> <optional>
<nullable>
Source:
Returns:
Type
shaka.media.InitSegmentReference

getLanguage_(languageValuenullable) → {string}

Get the normalized language value.
Parameters:
Name Type Attributes Description
languageValue string <nullable>
Source:
Returns:
Type
string

getLiveDuration_() → {number}

Source:
Returns:
Type
number

getMediaSequenceToStartTimeFor_(streamInfonon-null) → {Map.<number, number>}

Parameters:
Name Type Description
streamInfo shaka.hls.HlsParser.StreamInfo
Source:
Returns:
Type
Map.<number, number>

getMinDuration_() → {number}

Source:
Returns:
Type
number

getNextMediaSequenceAndPart_(mediaSequenceNumber, segmentsnon-null) → {{nextMediaSequence: number, nextPart:number}}

Get the next msn and part
Parameters:
Name Type Description
mediaSequenceNumber number
segments Array.<!shaka.media.SegmentReference>
Source:
Returns:
}
Type
{nextMediaSequence: number, nextPart:number}

getRequiredTag_(tagsnon-null, tagName) → {shaka.hls.Tag}

Returns a tag with a given name. Throws an error if tag was not found.
Parameters:
Name Type Description
tags Array.<shaka.hls.Tag>
tagName string
Source:
Returns:
Type
shaka.hls.Tag

getSampleRate_(tagnon-null) → {number}

Get the sample rate information for an HLS audio track.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
Type
number

getType_(tagnon-null) → {string}

Get the type value. Shaka recognizes the content types 'audio', 'video', 'text', and 'image'. The HLS 'subtitles' type needs to be mapped to 'text'.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
Returns:
Type
string

getUpdatePlaylistDelay_() → {number}

Source:
Returns:
Type
number

guessMimeType_(contentType, codecs, segmentsnon-null) → {Promise.<string>}

Attempts to guess stream's mime type.
Parameters:
Name Type Description
contentType string
codecs string
segments Array.<!shaka.media.SegmentReference>
Source:
Returns:
Type
Promise.<string>

guessMimeTypeBeforeLoading_(contentType, codecs) → {string}

Attempts to guess stream's mime type based on content type and URI.
Parameters:
Name Type Description
contentType string
codecs string
Source:
Returns:
Type
string

guessMimeTypeFallback_(contentType) → {string}

Get a fallback mime type for the content. Used if all the better methods for determining the mime type have failed.
Parameters:
Name Type Description
contentType string
Source:
Returns:
Type
string

hasEnoughInfoToFinalizeStreams_() → {boolean}

There are some values on streams that can only be set once we know about both the video and audio content, if present. This checks if there is at least one video downloaded (if the media has video), and that there is at least one audio downloaded (if the media has audio).
Source:
Returns:
Type
boolean

identityDrmParser_(drmTagnon-null, mimeType, getUris, initSegmentRefnullable, variablesopt, nullable) → {Promise.<?shaka.extern.DrmInfo>}

See: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-11#section-5.1
Parameters:
Name Type Attributes Description
drmTag shaka.hls.Tag
mimeType string
getUris function(): !Array.<string>
initSegmentRef shaka.media.InitSegmentReference <nullable>
variables Map.<string, string> <optional>
<nullable>
Source:
Returns:
Type
Promise.<?shaka.extern.DrmInfo>

ignoreManifestProgramDateTimeFor_(type) → {boolean}

Parameters:
Name Type Description
type string
Source:
Returns:
Type
boolean

isAesMethod_(method) → {boolean}

Parameters:
Name Type Description
method string
Source:
Returns:
Type
boolean

isLive_() → {boolean}

Source:
Returns:
Type
boolean

isPreloadFn_()

Source:

isSpatialAudio_(tagnon-null) → {boolean}

Get the spatial audio information for an HLS audio track. In HLS the channels field indicates the number of audio channels that the stream has (eg: 2). In the case of Dolby Atmos, the complexity is expressed with the number of channels followed by the word JOC (eg: 16/JOC), so 16 would be the number of channels (eg: 7.3.6 layout), and JOC indicates that the stream has spatial audio.
Parameters:
Name Type Description
tag shaka.hls.Tag
Source:
See:
Returns:
Type
boolean

makeNetworkRequest_(request, type, contextopt) → {shaka.net.NetworkingEngine.PendingRequest}

Create a networking request. This will manage the request using the parser's operation manager. If the parser has already been stopped, the request will not be made.
Parameters:
Name Type Attributes Description
request shaka.extern.Request
type shaka.net.NetworkingEngine.RequestType
context shaka.extern.RequestContext <optional>
Source:
Returns:
Type
shaka.net.NetworkingEngine.PendingRequest

makeStreamObject_(id, codecs, type, languageValuenullable, primary, namenullable, channelsCountnullable, closedCaptions, characteristicsnullable, forced, sampleRatenullable, spatialAudio) → {shaka.extern.Stream}

Creates a stream object with the given parameters. The parameters that are passed into here are only the things that can be known without downloading the media playlist; other values must be set manually on the object after creation.
Parameters:
Name Type Attributes Description
id number
codecs string
type string
languageValue string <nullable>
primary boolean
name string <nullable>
channelsCount number <nullable>
closedCaptions Map.<string, string>
characteristics string <nullable>
forced boolean
sampleRate number <nullable>
spatialAudio boolean
Source:
Returns:
Type
shaka.extern.Stream

notifySegmentsForStreams_(streamsnon-null)

Parameters:
Name Type Description
streams Array.<!shaka.extern.Stream>
Source:

offsetStreamInfo_(streamInfonon-null, offset)

Parameters:
Name Type Description
streamInfo shaka.hls.HlsParser.StreamInfo
offset number
Source:

onExpirationUpdated(sessionId, expiration)

Tells the parser that the expiration time of an EME session has changed. Implementing this is optional.
Parameters:
Name Type Description
sessionId string
expiration number
Implements:
Source:

onInitialVariantChosen(variant)

Tells the parser that the initial variant has been chosen.
Parameters:
Name Type Description
variant shaka.extern.Variant
Implements:
Source:

onUpdate_() → {Promise}

Called when the update timer ticks. Because parsing a manifest is async, this method is async. To work with this, this method will schedule the next update when it finished instead of using a repeating-start.
Source:
Returns:
Type
Promise

parseAESDrmTag_(drmTagnon-null, playlistnon-null, getUris, variablesopt, nullable) → {shaka.extern.aesKey}

Parameters:
Name Type Attributes Description
drmTag shaka.hls.Tag
playlist shaka.hls.Playlist
getUris function(): !Array.<string>
variables Map.<string, string> <optional>
<nullable>
Source:
Returns:
Type
shaka.extern.aesKey

parseByteRange_(previousReference, byterangenullable) → {Array.<number>}

Parse the startByte and endByte.
Parameters:
Name Type Attributes Description
previousReference shaka.media.SegmentReference
byterange string <nullable>
Source:
Returns:
An array with the start byte and end byte.
Type
Array.<number>

parseClosedCaptions_(mediaTagsnon-null)

Parses an array of EXT-X-MEDIA tags, then stores the values of all tags with TYPE="CLOSED-CAPTIONS" into a map of group id to closed captions.
Parameters:
Name Type Description
mediaTags Array.<!shaka.hls.Tag>
Source:

parseCodecs_(tagsnon-null)

Get the codecs of each variant tag, and store in a map from audio/video/subtitle group id to the codecs arraylist.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag> Variant tags from the playlist.
Source:

parseDrmInfo_(playlistnon-null, mimeType, getUris, variablesopt, nullable) → {Promise.<{drmInfos: !Array.<shaka.extern.DrmInfo>, keyIds: !Set.<string>, encrypted: boolean, aesEncrypted: boolean}>}

Parameters:
Name Type Attributes Description
playlist shaka.hls.Playlist
mimeType string
getUris function(): !Array.<string>
variables Map.<string, string> <optional>
<nullable>
Source:
Returns:
Type
Promise.<{drmInfos: !Array.<shaka.extern.DrmInfo>, keyIds: !Set.<string>, encrypted: boolean, aesEncrypted: boolean}>

parseIFrames_(iFrameTagsnon-null) → {Array.<!shaka.extern.Stream>}

Parameters:
Name Type Description
iFrameTags Array.<!shaka.hls.Tag> from the playlist.
Source:
Returns:
Type
Array.<!shaka.extern.Stream>

parseImages_(imageTagsnon-null, iFrameTagsnon-null) → {Promise.<!Array.<!shaka.extern.Stream>>}

Parameters:
Name Type Description
imageTags Array.<!shaka.hls.Tag> from the playlist.
iFrameTags Array.<!shaka.hls.Tag> from the playlist.
Source:
Returns:
Type
Promise.<!Array.<!shaka.extern.Stream>>

parseManifest_(data, uri) → {Promise}

Parses the manifest.
Parameters:
Name Type Description
data BufferSource
uri string
Source:
Returns:
Type
Promise

parseMasterVariables_(tagsnon-null)

Get the variables of each variant tag, and store in a map.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag> Variant tags from the playlist.
Source:

parseMediaVariables_(tagsnon-null, uri) → {Map.<string, string>}

Get the variables of each variant tag, and store in a map.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag> Variant tags from the playlist.
uri string Media playlist URI.
Source:
Returns:
Type
Map.<string, string>

parseTexts_(mediaTagsnon-null) → {Array.<!shaka.extern.Stream>}

Parse Subtitles and Closed Captions from 'EXT-X-MEDIA' tags. Create text streams for Subtitles, but not Closed Captions.
Parameters:
Name Type Description
mediaTags Array.<!shaka.hls.Tag> Media tags from the playlist.
Source:
Returns:
Type
Array.<!shaka.extern.Stream>

processContentSteering_(tagsnon-null) → {Promise}

Process EXT-X-CONTENT-STEERING tags.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag>
Source:
Returns:
Type
Promise

processDateRangeTags_(tagsnon-null, contentType, variablesnon-null, getUris)

Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag>
contentType string
variables Map.<string, string>
getUris function(): !Array.<string>
Source:

processSessionData_(tagsnon-null)

Process EXT-X-SESSION-DATA tags.
Parameters:
Name Type Description
tags Array.<!shaka.hls.Tag>
Source:

requestManifest_(urisnon-null, isPlaylistopt) → {shaka.net.NetworkingEngine.PendingRequest}

Makes a network request for the manifest and returns a Promise with the resulting data.
Parameters:
Name Type Attributes Description
uris Array.<string>
isPlaylist boolean <optional>
Source:
Returns:
Type
shaka.net.NetworkingEngine.PendingRequest

setFullTypeForStream_(streamnon-null)

Parameters:
Name Type Description
stream shaka.extern.Stream
Source:

setMediaElement(mediaElement)

Set media element.
Parameters:
Name Type Description
mediaElement HTMLMediaElement
Implements:
Source:

setPresentationType_(type)

Parameters:
Name Type Description
type shaka.hls.HlsParser.PresentationType_
Source:

start(uri, playerInterface) → {Promise.<shaka.extern.Manifest>}

Initialize and start the parser. When |start| resolves, it should return the initial version of the manifest. |start| will only be called once. If |stop| is called while |start| is pending, |start| should reject.
Parameters:
Name Type Description
uri string The URI of the manifest.
playerInterface shaka.extern.ManifestParser.PlayerInterface The player interface contains the callbacks and members that the parser can use to communicate with the player and outside world.
Implements:
Source:
Returns:
Type
Promise.<shaka.extern.Manifest>

stop() → {Promise}

Tell the parser that it must stop and free all internal resources as soon as possible. Only once all internal resources are stopped and freed will the promise resolve. Once stopped a parser will not be started again. The parser should support having |stop| called multiple times and the promise should always resolve.
Implements:
Source:
Returns:
Type
Promise

syncStreamsWithProgramDateTime_(streamInfosnon-null)

Synchronize streams by the EXT-X-PROGRAM-DATE-TIME tags attached to their segments. Also normalizes segment times so that the earliest segment in any stream is at time 0.
Parameters:
Name Type Description
streamInfos Array.<!shaka.hls.HlsParser.StreamInfo>
Source:

syncStreamsWithSequenceNumber_(streamInfosnon-null, forceopt)

Align the streams by sequence number by dropping early segments. Then offset the streams to begin at presentation time 0.
Parameters:
Name Type Attributes Default Description
streamInfos Array.<!shaka.hls.HlsParser.StreamInfo>
force boolean <optional>
false
Source:

update()

Tells the parser to do a manual manifest update. Implementing this is optional. This is only called when 'emsg' boxes are present.
Implements:
Source:

updateStream_(streamInfonon-null) → {Promise}

Updates a stream.
Parameters:
Name Type Description
streamInfo shaka.hls.HlsParser.StreamInfo
Source:
Returns:
Type
Promise

Type Definitions

DrmParser_

Type:
  • function(!shaka.hls.Tag, string):?shaka.extern.DrmInfo
Source:

StreamInfo

Contains a stream and information about it.
Type:
  • {stream: !shaka.extern.Stream, type: string, redirectUris: !Array.<string>, getUris: function(): !Array.<string>, minTimestamp: number, maxTimestamp: number, mediaSequenceToStartTime: !Map.<number, number>, canSkipSegments: boolean, canBlockReload: boolean, hasEndList: boolean, firstSequenceNumber: number, nextMediaSequence: number, nextPart: number, loadedOnce: boolean}
Properties:
Name Type Description
stream shaka.extern.Stream The Stream itself.
type string The type value. Could be 'video', 'audio', 'text', or 'image'.
redirectUris Array.<string> The redirect URIs.
getUris function The verbatim media playlist URIs, as it appeared in the master playlist.
minTimestamp number The minimum timestamp found in the stream.
maxTimestamp number The maximum timestamp found in the stream.
mediaSequenceToStartTime Map.<number, number> A map of media sequence numbers to media start times. Only used for VOD content.
canSkipSegments boolean True if the server supports delta playlist updates, and we can send a request for a playlist that can skip older media segments.
canBlockReload boolean True if the server supports blocking playlist reload, and we can send a request for a playlist that can block reload until some segments are present.
hasEndList boolean True if the stream has an EXT-X-ENDLIST tag.
firstSequenceNumber number The sequence number of the first reference. Only calculated if needed.
nextMediaSequence number The next media sequence.
nextPart number The next part.
loadedOnce boolean True if the stream has been loaded at least once.
Source:

StreamInfos

Audio and video stream infos.
Type:
Properties:
Name Type Description
audio Array.<shaka.hls.HlsParser.StreamInfo>
video Array.<shaka.hls.HlsParser.StreamInfo>
Source: