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.
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.
The real PROGRAM-DATE-TIME of each segment reference, in seconds since
1970, captured before the discontinuity-gap correction is applied to its
syncTime. Keyed by the reference so it survives reuse across live
updates and is garbage-collected with the reference on eviction. Used to
report an accurate playhead date across discontinuities.
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.
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.
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_.
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.
Resolve the streamInfos that were already created (via
createStreamInfosFromMediaTags_) for a set of alternative rendition
group ids, e.g. the AUDIO or VIDEO group ids of an EXT-X-STREAM-INF tag.
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).
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 (EAC-3), 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. For Dolby AC-4 ATMOS,
it's necessary search ATMOS word.
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.
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.
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.
Rebuilds the presentation timeline's program-date-time regions from the
full current segment index of the given stream (video is used as the
source of truth), mapping a presentation time to its real wall-clock time.
A region boundary is detected wherever the offset between a segment's real
PDT and its |syncTime| changes. |syncTime| is the presentation time after
the discontinuity-gap correction, so this offset is exactly the gap that
was removed: it stays constant while segments are continuous (regardless of
sub-second clock drift between PROGRAM-DATE-TIME tags, since both values
move together) and only changes where the parser added or reverted a gap -
i.e. at a real discontinuity, or once a discontinuity scrolls out of a live
window and syncAgainst() repositions a later segment from its raw syncTime.
Anchoring a fresh region there keeps getPlayheadTimeAsDate() accurate
instead of extrapolating across the shift. Reading the whole window -
rather than only the freshly parsed tail - is what lets us notice it. Each
segment's real PDT is looked up from |realProgramDateTimeByReference_|,
which is unaffected by the gap correction applied to |syncTime|.
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.
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.
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.
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.
This is indicated by the presence of the CAN-SKIP-UNTIL=YES
attribute in the EXT-X-SERVER-CONTROL tag.
canSkipDateRanges
boolean
True if the server supports delta playlist updates that can skip
older EXT-X-DATERANGE tags, in addition to skipping older media
segments. This is indicated by the presence of the
CAN-SKIP-DATERANGES=YES attribute in the EXT-X-SERVER-CONTROL tag,
and requires CAN-SKIP-UNTIL to be present.
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.