Constructor
new MSFParser()
Members
INDEX_RETENTION_SEC_ :number
How many seconds of SegmentReferences to keep in the index behind the newest
one.
Must exceed how far StreamingEngine can lag the live edge, because it walks
the index in order and cannot skip to content whose predecessor has been
evicted. Where one reference is one frame this is a large number of
references but a small amount of memory.
Type:
- number
- Source:
MIN_AVAILABILITY_WINDOW_SEC_ :number
Floor for the live segment-availability window, in seconds.
Deriving the window from one object's duration gives tens of milliseconds on
a frame-per-object packaging. That is too narrow on two counts: the
playhead, which trails the live edge, falls outside its own seek range and
is re-seeked continuously; and the trailing track of a pair published a few
hundred milliseconds apart is never inside the window at all, so
StreamingEngine reports "cannot find segment" for it forever.
Bounded from above as well. This window IS the seek range, so it is what
the player offers the user as DVR, and it is how far the playhead may drift
behind the live edge before being pulled back to it. Neither is wanted on a
transport chosen for low latency, and a window of five seconds or more also
makes the UI show a seek bar (shaka.ui.SeekBar's minimum seek window), which
would advertise DVR on a stream that has none.
The quantity it has to cover is the lag between the newest reference and the
newest sample actually appended, since that is where the playhead can be.
Measured on a live LOC stream, that lag ran 2.0-4.7 s and the playhead sat
1.0-3.8 s behind the live edge; a window of 1.5 s put it outside the range
again and it thrashed.
Type:
- number
- Source:
bandwidthSamples_ :Map<string, {bytes: number, readMs: number, group: bigint}>
The in-progress ABR bandwidth sample for each track, keyed by track key.
Tracks are accumulated separately because each has its own group
sequence.
Type:
- Map<string, {bytes: number, readMs: number, group: bigint}>
- Source:
catalogPromise_ :Promise.PromiseWithResolvers
Type:
- Promise.PromiseWithResolvers
- Source:
publishNamespaces_ :Array<Array<string>>
Type:
- Array<Array<string>>
- Source:
receivedFirstSegment_ :Set<shaka.util.ManifestParserUtils.ContentType>
Tracks whether the first segment has been received for each content type.
Used to delay locking the presentation timeline until all expected
stream types have started producing data.
Type:
- Source:
unregisterPublishNamespaceCallback_ :?function()
Type:
- ?function()
- Source:
unregisterTracksCallback_ :Map<string, function()>
Type:
- Map<string, function()>
- Source:
Methods
addSegment_(stream, type, segmentnon-null, initSegmentReference)
Adds a segment produced by a packaging's segmenter to a stream's segment
index and advances the presentation timeline to cover it.
Parameters:
| Name | Type | Description |
|---|---|---|
stream |
shaka.extern.Stream | |
type |
shaka.util.ManifestParserUtils.ContentType | |
segment |
shaka.extern.MsfSegment | |
initSegmentReference |
shaka.media.InitSegmentReference |
- 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:
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:
createVariants_()
- Source:
fetchCatalog_(namespace) → {Promise}
Fetch the catalog using FETCH (one-shot)
Parameters:
| Name | Type | Description |
|---|---|---|
namespace |
Array<string> |
- Source:
Returns:
- Type
- Promise
getCatalog_(namespace) → {Promise}
Get the catalog in the given namespace
Parameters:
| Name | Type | Description |
|---|---|---|
namespace |
Array<string> |
- Source:
Returns:
- Type
- Promise
getContentProtections_(catalog) → {Map<string, !shaka.extern.DrmInfo>}
Parameters:
| Name | Type | Description |
|---|---|---|
catalog |
msfCatalog.Catalog |
- Source:
Returns:
- Type
- Map<string, !shaka.extern.DrmInfo>
isPreloadFn_()
- Source:
listenForAnnouncements_()
Listen for announcements from the server
- 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:
processCatalog_(catalog) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
catalog |
msfCatalog.Catalog |
- Source:
Returns:
- Type
- Promise
processTrack_(track, contentProtectionsnon-null, initDataListnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
track |
msfCatalog.Track | |
contentProtections |
Map<string, !shaka.extern.DrmInfo> | |
initDataList |
Map<string, string> |
- Source:
recordBandwidthSample_(trackKey, location, byteLength, readMs)
Feed the ABR bandwidth estimator.
MoQ delivers media as many small per-object (often per-frame) chunks, which
are individually too small for the bandwidth estimator to draw a useful
throughput sample from. A group is the natural aggregation unit, so
accumulate a group's objects and report one sample once the group is
complete, which we detect by the object's group changing.
The time reported is the sum of the per-object active read
durations, not wall clock. A push stream delivers at (roughly) the encoded
rate, so wall-clock timing would only ever measure the current variant's
bitrate and ABR could never learn there is spare capacity. When the link
has headroom the objects sit ready in the transport buffer and read almost
instantly, so the active read time reflects the true link speed and lets
ABR climb to a variant the connection can actually sustain.
Parameters:
| Name | Type | Description |
|---|---|---|
trackKey |
string | |
location |
shaka.msf.Utils.Location | |
byteLength |
number | |
readMs |
number | Active time spent reading this object from the stream. |
- Source:
setMediaElement(mediaElement)
Set media element.
Parameters:
| Name | Type | Description |
|---|---|---|
mediaElement |
HTMLMediaElement |
- Implements:
- 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
subscribeToCatalog_(namespace) → {Promise}
Subscribe to the catalog in the given namespace
Parameters:
| Name | Type | Description |
|---|---|---|
namespace |
Array<string> |
- Source:
Returns:
- Type
- Promise
subscribeToTrack(track, trackKey, callback) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
track |
msfCatalog.Track | |
trackKey |
string | |
callback |
shaka.msf.Utils.ObjectCallback |
- Source:
Returns:
- Type
- Promise
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: