Class: shaka.ads.HlsInterstitialParser

Constructor

new HlsInterstitialParser()

Source:

Members

metadataIds_ :Set<string>

Type:
  • Set<string>
Source:

sessionId_ :string

Type:
  • string
Source:

Methods

createDeferredInterstitial(descriptornon-null, networkingEnginenon-null, sessionId) → {shaka.extern.DeferredInterstitial}

Creates a deferred resolver for an HLS asset list. Parsing remains pure; only invoking resolve performs the request. The common manager controls when to invoke it and can abort it without knowing the resource format.
Parameters:
Name Type Description
descriptor shaka.ads.HlsInterstitialParser.AssetListDescriptor
networkingEngine shaka.net.NetworkingEngine
sessionId string
Source:
Returns:
Type
shaka.extern.DeferredInterstitial

getInterstitialTimes_(hlsMetadata, idnullable) → {{startTime: number, endTime: ?number}}

Computes the start/end times of an interstitial from its HLS metadata. When the Date Range has no ID, the times are floored to a tenth of a second.
Parameters:
Name Type Attributes Description
hlsMetadata shaka.extern.HLSMetadata
id string <nullable>
Source:
Returns:
Type
{startTime: number, endTime: ?number}

getMetadataValue(hlsMetadata, key) → {string}

Returns the string data of the HLS metadata frame with the given key, or null if there is no such frame.
Parameters:
Name Type Description
hlsMetadata shaka.extern.HLSMetadata
key string
Source:
Returns:
Type
string

getUriWithParams(uri, sessionId, offsetopt) → {string}

Parameters:
Name Type Attributes Default Description
uri string
sessionId string
offset number <optional>
0
Source:
Returns:
Type
string

isInterstitialMetadata(metadata) → {boolean}

Parameters:
Name Type Description
metadata shaka.extern.HLSMetadata
Source:
Returns:
Type
boolean

parseAssetList(datanon-null, descriptornon-null, responseUri, startOffsetopt) → {Array<shaka.extern.AdInterstitial>}

Parses a fetched asset list without performing requests. URI resolution uses the response URI, including redirects. Assets skipped on a live start retain their original indexes and offsets.
Parameters:
Name Type Attributes Default Description
data shaka.ads.HlsInterstitialParser.AssetsList
descriptor shaka.ads.HlsInterstitialParser.AssetListDescriptor
responseUri string
startOffset number <optional>
0
Source:
Returns:
Type
Array<shaka.extern.AdInterstitial>

parseCue_(hlsMetadata) → {{once: boolean, pre: boolean, post: boolean}}

Parses the CUE attribute (ONCE/PRE/POST) from HLS metadata. X-CUE was the provisional name and is supported as a fallback for compatibility.
Parameters:
Name Type Description
hlsMetadata shaka.extern.HLSMetadata
Source:
Returns:
Type
{once: boolean, pre: boolean, post: boolean}

parseMetadata(hlsMetadata, isLive) → {shaka.ads.HlsInterstitialParser.ParsedMetadata}

Parameters:
Name Type Description
hlsMetadata shaka.extern.HLSMetadata
isLive boolean
Source:
Returns:
Type
shaka.ads.HlsInterstitialParser.ParsedMetadata

parseOverlay_(hlsMetadata) → {Array<shaka.extern.AdInterstitial>}

Parameters:
Name Type Description
hlsMetadata shaka.extern.HLSMetadata
Source:
Returns:
Type
Array<shaka.extern.AdInterstitial>

parse(metadata, isLive, networkingEnginenon-null, insertion, measurement) → {shaka.ads.HlsInterstitialParser.Result}

Converts a metadata frame into what the interstitial manager must schedule or update. Insertion (HLS interstitials) and measurement (SVTA) can be enabled independently.
Parameters:
Name Type Description
metadata shaka.extern.HLSMetadata
isLive boolean
networkingEngine shaka.net.NetworkingEngine
insertion boolean Whether HLS interstitials are enabled.
measurement boolean Whether SVTA signaling is enabled.
Source:
Returns:
Type
shaka.ads.HlsInterstitialParser.Result

Type Definitions

Asset

Type:
  • {URI: string, DURATION: number, X-AD-CREATIVE-SIGNALING: (shaka.extern.AdCreativeSignaling.CarriageEnvelope|undefined)}
Properties:
Name Type Attributes Description
URI string
DURATION number
X-AD-CREATIVE-SIGNALING shaka.extern.AdCreativeSignaling.CarriageEnvelope <nullable>
Source:

AssetListDescriptor

Holds the parsed metadata of an HLS X-ASSET-LIST interstitial whose resolution has been deferred until playback approaches it.
Type:
  • {id: ?string, groupId: ?string, startTime: number, endTime: ?number, assetListUri: string, isSkippable: boolean, skipOffset: ?number, skipFor: ?number, canJump: boolean, resumeOffset: ?number, playoutLimit: ?number, once: boolean, pre: boolean, post: boolean, timelineRange: boolean, resolutionTimeOffset: (number|undefined), resolving: boolean, resolved: boolean}
Properties:
Name Type Attributes Description
id string <nullable>
groupId string <nullable>
startTime number
endTime number <nullable>
assetListUri string
isSkippable boolean
skipOffset number <nullable>
skipFor number <nullable>
canJump boolean
resumeOffset number <nullable>
playoutLimit number <nullable>
once boolean
pre boolean
post boolean
timelineRange boolean
resolutionTimeOffset number | undefined The offset in seconds before startTime at which the asset list may be resolved. Undefined or 0 means use the interstitialPreloadAheadTime default.
resolving boolean Whether a deferred resolution request is already in flight.
resolved boolean Whether the asset list has already been resolved. Retained (only for live streams that allow starting mid-interstitial) so that seeking back into the break can re-request the asset list with an updated _HLS_start_offset.
Source:

AssetsList

Type:
Properties:
Name Type Attributes Description
ASSETS Array<shaka.ads.HlsInterstitialParser.Asset>
SKIP-CONTROL shaka.ads.HlsInterstitialParser.SkipControl <nullable>
X-AD-CREATIVE-SIGNALING shaka.extern.AdCreativeSignaling.CarriageEnvelope <nullable>
Source:

Result

Type:
Properties:
Name Type Attributes Description
interstitials Array<shaka.extern.AdInterstitial> Interstitials ready to be scheduled.
deferred Array<!shaka.extern.DeferredInterstitial> Resources (asset lists, remote pods) to be resolved before scheduling.
playoutLimitUpdate Object <nullable>
A playout limit for an interstitial or resource that may already exist.
preloadHint Object <nullable>
The time from which the target's resources may be resolved.
Source:

SkipControl

Type:
  • {OFFSET: (number|undefined), DURATION: (number|undefined)}
Properties:
Name Type Description
OFFSET number
DURATION number
Source: