Constructor
new DashJsonParser()
- Extends:
- Source:
Extends
Members
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:
- Inherited From:
- Source:
contextCache_ :Map<string, !shaka.dash.DashParser.Context>
This is a cache is used the store a snapshot of the context
object which is built up throughout node traversal to maintain
a current state. This data needs to be preserved for parsing
patches.
The key is a combination period and representation id's.
Type:
- Map<string, !shaka.dash.DashParser.Context>
- Inherited From:
- Source:
continuityCache_ :Map<string, {endTime: number, timeline: number, reps: Array<string>}>
Type:
- Map<string, {endTime: number, timeline: number, reps: Array<string>}>
- Inherited From:
- Source:
gapCount_ :number
Type:
- number
- Inherited From:
- Source:
globalId_ :number
Type:
- number
- Inherited From:
- Source:
indexStreamMap_ :Map<string, !Array<string>>
A map of Period IDs to Stream Map IDs.
Use to have direct access to streamMap key.
Type:
- Map<string, !Array<string>>
- Inherited From:
- Source:
isLowLatency_ :boolean
Type:
- boolean
- Inherited From:
- Source:
isTransitionFromDynamicToStatic_ :boolean
Type:
- boolean
- Inherited From:
- Source:
largestPeriodStartTime_ :number
Largest period start time seen.
Type:
- number
- Inherited From:
- Source:
lastCalculatedBaseUris_ :Array<string>
Type:
- Array<string>
- Inherited From:
- Source:
lastManifestQueryParams_ :string
Type:
- string
- Inherited From:
- Source:
lastManifestUpdatePeriodIds_ :Array<string>
Period IDs seen in previous manifest.
Type:
- Array<string>
- Inherited From:
- Source:
lowLatencyMode_ :boolean
Type:
- boolean
- Inherited From:
- Source:
manifestPatchContext_ :shaka.dash.DashParser.PatchContext
A context of the living manifest used for processing
Patch MPD's
Type:
- Inherited From:
- Source:
manifestUris_ :Array<string>
Type:
- Array<string>
- Inherited From:
- Source:
minTotalAvailabilityTimeOffset_ :number
The minimum of the availabilityTimeOffset values among the adaptation
sets.
Type:
- number
- Inherited From:
- Source:
parsedPrftNodes_ :Set<!shaka.extern.xml.Node>
Used to track which prft nodes have been already parsed to avoid
duplicating work for all representations.
Type:
- Set<!shaka.extern.xml.Node>
- Inherited From:
- Source:
patchLocationNodes_ :Array<shaka.extern.xml.Node>
Type:
- Array<shaka.extern.xml.Node>
- Inherited From:
- Source:
periodDurations_ :Map<string, number>
A map of period ids to their durations
Type:
- Map<string, number>
- Inherited From:
- Source:
streamMap_ :Map<string, !shaka.extern.Stream>
A map of IDs to Stream objects.
ID: Period@id,Representation@id
e.g.: '1,23'
Type:
- Map<string, !shaka.extern.Stream>
- Inherited From:
- Source:
updatePeriod_ :number
The update period in seconds, or 0 for no updates.
Type:
- number
- Inherited From:
- Source:
Methods
cleanContinuityCache_(periodsnon-null)
Clean continuityCache Object to remove reference of removed periods.
This should end up running after the current manifest has been processed
so that it can use previous periods to calculate the continuity of the new
periods.
Parameters:
| Name | Type | Description |
|---|---|---|
periods |
Array<shaka.extern.Period> |
- Inherited From:
- Source:
cleanStreamMap_()
Clean StreamMap Object to remove reference of deleted Stream Object
- Inherited From:
- Source:
cloneContext_(contextnon-null) → {shaka.dash.DashParser.Context}
Clone context and remove xml document references.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
shaka.dash.DashParser.Context |
- Inherited From:
- Source:
Returns:
createFrame_(elemnon-null, parentnullable, getBaseUrisnullable) → {shaka.dash.DashParser.InheritanceFrame}
Creates a new inheritance frame for the given element.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
elem |
shaka.extern.xml.Node | ||
parent |
shaka.dash.DashParser.InheritanceFrame |
<nullable> |
|
getBaseUris |
function |
<nullable> |
- Inherited From:
- Source:
Returns:
emsgSchemeIdUris_(inBandEventStreamsnon-null, emsgSchemeIdUrisnon-null) → {Array<string>}
Returns a new array of InbandEventStream schemeIdUri containing the union
of the ones parsed from inBandEventStreams and the ones provided in
emsgSchemeIdUris.
Parameters:
| Name | Type | Description |
|---|---|---|
inBandEventStreams |
Array<!shaka.extern.xml.Node> | Array of InbandEventStream elements to parse and add to the returned array. |
emsgSchemeIdUris |
Array<string> | Array of parsed InbandEventStream schemeIdUri attributes to add to the returned array. |
- Inherited From:
- Source:
Returns:
schemeIdUris Array of parsed
InbandEventStream schemeIdUri attributes.
- Type
- Array<string>
getContextIdsFromPath_(pathsnon-null) → {Array<string>}
Parameters:
| Name | Type | Description |
|---|---|---|
paths |
Array<shaka.util.TXml.PathNode> |
- Inherited From:
- Source:
Returns:
- Type
- Array<string>
getPatchLocationUris_() → {Array<string>}
- Inherited From:
- Source:
Returns:
- Type
- Array<string>
getStreamsFromSets_(disabled, adaptationSetsnon-null, contentType)
Gets the streams from the given sets or returns an empty array if disabled
or no streams are found.
Parameters:
| Name | Type | Description |
|---|---|---|
disabled |
boolean | |
adaptationSets |
Array<!shaka.dash.DashParser.AdaptationInfo> | |
contentType |
string |
- Inherited From:
- Source:
getURLParametersFunction_(elemnon-null) → {function}
Parameters:
| Name | Type | Description |
|---|---|---|
elem |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
- Type
- function
isPreloadFn_()
- Inherited From:
- Source:
makeNetworkRequest_(request, type, contextopt) → {Promise<shaka.extern.Response>}
Create a networking request. This will manage the request using the
parser's operation manager.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
request |
shaka.extern.Request | ||
type |
shaka.net.NetworkingEngine.RequestType | ||
context |
shaka.extern.RequestContext |
<optional> |
- Inherited From:
- Source:
Returns:
- Type
- Promise<shaka.extern.Response>
modifySegmentTemplate_(patchNodenon-null) → {Array<string>}
Modifies SegmentTemplate based on MPD patch.
Parameters:
| Name | Type | Description |
|---|---|---|
patchNode |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
context ids with updated timeline
- Type
- Array<string>
modifyTimepoints_(patchNodenon-null) → {Array<string>}
Ingests Patch MPD segments into timeline.
Parameters:
| Name | Type | Description |
|---|---|---|
patchNode |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
context ids with updated timeline
- Type
- Array<string>
onUpdate_() → {Promise}
Called when the update timer ticks.
- Inherited From:
- Source:
Returns:
- Type
- Promise
parseAdaptationSet_(context, position, elemnon-null) → {shaka.dash.DashParser.AdaptationInfo}
Parses an AdaptationSet XML element.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
shaka.dash.DashParser.Context | |
position |
number | |
elem |
shaka.extern.xml.Node | The AdaptationSet element. |
- Inherited From:
- Source:
Returns:
parseAudioChannels_(audioChannelConfigsnon-null) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
audioChannelConfigs |
Array<!shaka.extern.xml.Node> | An array of AudioChannelConfiguration elements. |
- Inherited From:
- Source:
Returns:
The number of audio channels, or null if unknown.
- Type
- number
parseEventStream_(periodStart, periodDurationnullable, elemnon-null, availabilityStart)
Parses an EventStream element.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
periodStart |
number | ||
periodDuration |
number |
<nullable> |
|
elem |
shaka.extern.xml.Node | ||
availabilityStart |
number |
- Inherited From:
- Source:
parseManifest(data, finalManifestUri, rootElement) → {Promise}
Parses the manifest XML. This also handles updates and will update the
stored manifest.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
BufferSource | |
finalManifestUri |
string | |
rootElement |
string |
- Overrides:
- Source:
Returns:
- Type
- Promise
parseMpdChaining_(mpdnon-null) → {string}
Reads chaining url.
Parameters:
| Name | Type | Description |
|---|---|---|
mpd |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
- Type
- string
parsePatchMediaPresentationDurationChange_(durationString)
Parameters:
| Name | Type | Description |
|---|---|---|
durationString |
string |
- Inherited From:
- Source:
parsePatchMpdTypeChange_(mpdTypenon-null)
Handles manifest type changes, this transition is expected to be
"dynamic" to "static".
Parameters:
| Name | Type | Description |
|---|---|---|
mpdType |
string |
- Inherited From:
- Source:
parsePatchPeriod_(periodsnon-null)
Ingests a full MPD period element from a patch update
Parameters:
| Name | Type | Description |
|---|---|---|
periods |
shaka.extern.xml.Node |
- Inherited From:
- Source:
parsePatchSegment_(contextId)
Parses modified segments.
Parameters:
| Name | Type | Description |
|---|---|---|
contextId |
string |
- Inherited From:
- Source:
parsePeriod_(context, getBaseUris, periodInfo) → {shaka.extern.Period}
Parses a Period XML element. Unlike the other parse methods, this is not
given the Node; it is given a PeriodInfo structure. Also, partial parsing
was done before this was called so start and duration are valid.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
shaka.dash.DashParser.Context | |
getBaseUris |
function | |
periodInfo |
shaka.dash.DashParser.PeriodInfo |
- Inherited From:
- Source:
Returns:
- Type
- shaka.extern.Period
parsePeriods_(context, getBaseUris, mpdnon-null, newPeriodnon-null) → {Object}
Reads and parses the periods from the manifest. This first does some
partial parsing so the start and duration is available when parsing
children.
Parameters:
| Name | Type | Description |
|---|---|---|
context |
shaka.dash.DashParser.Context | |
getBaseUris |
function | |
mpd |
shaka.extern.xml.Node | |
newPeriod |
boolean |
- Inherited From:
- Source:
Returns:
- Type
- Object
parseProducerReferenceTime_(prftNodenon-null, streamInfonon-null, presentationTimelinenon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
prftNode |
shaka.extern.xml.Node | |
streamInfo |
shaka.dash.DashParser.StreamInfo | |
presentationTimeline |
shaka.media.PresentationTimeline |
- Inherited From:
- Source:
parseRepresentation_(context, contentProtection, kind, language, labelnullable, isPrimary, rolesnon-null, closedCaptions, nodenon-null, accessibilityPurposenullable, lastSegmentNumbernullable) → {shaka.extern.Stream}
Parses a Representation XML element.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
shaka.dash.DashParser.Context | ||
contentProtection |
shaka.dash.ContentProtection.Context | ||
kind |
string | undefined | ||
language |
string | ||
label |
string |
<nullable> |
|
isPrimary |
boolean | ||
roles |
Array<string> | ||
closedCaptions |
Map<string, string> | ||
node |
shaka.extern.xml.Node | ||
accessibilityPurpose |
shaka.media.ManifestParser.AccessibilityPurpose |
<nullable> |
|
lastSegmentNumber |
number |
<nullable> |
- Inherited From:
- Source:
Returns:
The Stream, or null when there is a
non-critical parsing error.
- Type
- shaka.extern.Stream
parseServiceDescription_(mpdnon-null) → {shaka.extern.ServiceDescription}
Reads maxLatency and maxPlaybackRate properties from service
description element.
Parameters:
| Name | Type | Description |
|---|---|---|
mpd |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
parseUtcTiming_(getBaseUris, elementsnon-null) → {Promise<number>}
Parses an array of UTCTiming elements.
Parameters:
| Name | Type | Description |
|---|---|---|
getBaseUris |
function | |
elements |
Array<!shaka.extern.xml.Node> |
- Inherited From:
- Source:
Returns:
- Type
- Promise<number>
postPeriodProcessing_(periodsnon-null, isPatchUpdate)
Handles common procedures after processing new periods.
Parameters:
| Name | Type | Description |
|---|---|---|
periods |
Array<shaka.extern.Period> | to be appended |
isPatchUpdate |
boolean | does call comes from mpd patch update |
- Inherited From:
- Source:
processManifest_(mpdnon-null, finalManifestUri) → {Promise}
Takes a formatted MPD and converts it into a manifest.
Parameters:
| Name | Type | Description |
|---|---|---|
mpd |
shaka.extern.xml.Node | |
finalManifestUri |
string | The final manifest URI, which may differ from this.manifestUri_ if there has been a redirect. |
- Inherited From:
- Source:
Returns:
- Type
- Promise
processParsedMpd(mpdnullable, finalManifestUri, rootElement) → {Promise}
Common point for processing an already parsed MPD (whether it comes from
direct XML or from JSON converted to XML by the subclass).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
mpd |
shaka.extern.xml.Node |
<nullable> |
|
finalManifestUri |
string | ||
rootElement |
string |
- Inherited From:
- Source:
Returns:
- Type
- Promise
processPatchManifest_(mpdnon-null) → {Promise}
Takes a formatted Patch MPD and converts it into a manifest.
Parameters:
| Name | Type | Description |
|---|---|---|
mpd |
shaka.extern.xml.Node |
- Inherited From:
- Source:
Returns:
- Type
- Promise
removePatchPeriod_(periodId)
Parameters:
| Name | Type | Description |
|---|---|---|
periodId |
string |
- Inherited From:
- Source:
requestForTiming_(getBaseUris, uri, method) → {Promise<number>}
Makes a request to the given URI and calculates the clock offset.
Parameters:
| Name | Type | Description |
|---|---|---|
getBaseUris |
function | |
uri |
string | |
method |
string |
- Inherited From:
- Source:
Returns:
- Type
- Promise<number>
requestManifest_() → {Promise<number>}
Makes a network request for the manifest and parses the resulting data.
- Inherited From:
- Source:
Returns:
Resolves with the time it took, in seconds, to
fulfill the request and parse the data.
- Type
- Promise<number>
requestSegment_(urisnon-null, startBytenullable, endBytenullable, isInit) → {Promise<BufferSource>}
Makes a network request on behalf of SegmentBase.createStreamInfo.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
uris |
Array<string> | ||
startByte |
number |
<nullable> |
|
endByte |
number |
<nullable> |
|
isInit |
boolean |
- Inherited From:
- Source:
Returns:
- Type
- Promise<BufferSource>
setUpdateTimer_(offset)
Sets the update timer. Does nothing if the manifest does not specify an
update period.
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number | An offset, in seconds, to apply to the manifest's update period. |
- Inherited From:
- Source:
updateNow_()
Update now the manifest
- Inherited From:
- Source:
updatePatchLocationNodes_(patchNodenon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
patchNode |
shaka.extern.xml.Node |
- Inherited From:
- Source:
verifyRepresentation_(frame) → {boolean}
Verifies that a Representation has exactly one Segment* element. Prints
warnings if there is a problem.
Parameters:
| Name | Type | Description |
|---|---|---|
frame |
shaka.dash.DashParser.InheritanceFrame |
- Inherited From:
- Source:
Returns:
True if the Representation is usable; otherwise return
false.
- Type
- boolean