Constructor
new InterstitialAdManager(adContainer, player, onEvent, configurePlayeropt, createTrackeropt, signalingopt, nullable)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
adContainer |
HTMLElement | |||
player |
shaka.Player | |||
onEvent |
function | |||
configurePlayer |
function |
<optional> |
Configures the player of an interstitial. | |
createTracker |
shaka.ads.InterstitialAdSession.TrackerFactory |
<optional> |
Creates the format specific tracker of an interstitial. | |
signaling |
shaka.ads.InterstitialAdManager.PresentationSignaling_ |
<optional> <nullable> |
null | Reads the format specific signaling of the ads carried in the presentation of an interstitial. |
- Implements:
- Source:
Members
PLAYOUT_LIMIT_TOLERANCE_ :number
Margin, in seconds, within which the playout limit of an ad is considered
reached when its media ends. Playback is measured from timeupdate events,
which stop slightly before the end of the media.
Type:
- number
RANGE_TOLERANCE_ :number
Margin, in seconds, within which a part of a presentation is too short to
be an ad of its own.
Type:
- number
adEventManager_ :shaka.util.EventManager
Type:
baseVideo_ :HTMLMediaElement
Type:
baseVideo_ :HTMLVideoElement
Type:
- HTMLVideoElement
baseVideo_ :HTMLVideoElement
Type:
- HTMLVideoElement
baseVideo_ :HTMLMediaElement
Type:
baseVideo_ :HTMLMediaElement
Type:
concurrentPresentation_ :shaka.ads.InterstitialConcurrentPresentation
The non-linear interstitial being presented with the primary content,
if any.
Type:
config_ :shaka.extern.AdsConfiguration
Type:
createTracker_ :shaka.ads.InterstitialAdSession.TrackerFactory
Type:
deferredInterstitials_ :Set<shaka.extern.DeferredInterstitial>
Interstitial resources whose resolution has been deferred until
playback approaches them. This avoids resolving every ad decision at
parse time, which would otherwise create a burst of concurrent requests.
See https://github.com/shaka-project/shaka-player/issues/10191
Type:
embeddedClickTarget_ :HTMLElement
Receives clicks on the current embedded slot, which has no element of
its own in the ad container.
Type:
- HTMLElement
embeddedInterstitial_ :shaka.extern.AdInterstitial
Type:
eventManager_ :shaka.util.EventManager
Type:
executions_ :Map<string, {count: number, delta: number}>
The executions of each interstitial with an id: how many times it
started playing and how late its last execution started, for the
player state parameters of the requests of DASH alternative MPD
events (ISO/IEC 23009-1 Annex I.4).
Type:
- Map<string, {count: number, delta: number}>
hasEmbeddedInterstitials_ :boolean
Type:
- boolean
interstitialIds_ :Set<string>
Type:
- Set<string>
interstitials_ :Set<shaka.extern.AdInterstitial>
Type:
lastAdCompleteTime_ :number
Wall-clock time (ms) when the last SGAI interstitial ad break finished
playing. Used to enforce the interstitialCooldown config.
Type:
- number
lastOnPlayoutLimit_ :?function()
Type:
- ?function()
lastPlayedAd_ :shaka.extern.AdInterstitial
Type:
layoutRenderer_ :shaka.ads.LayoutRenderer
Places the primary video and the assets of the interstitial being
presented.
Type:
media_ :shaka.ads.InterstitialMediaAsset
The media asset of the interstitials played as video.
Type:
onEvent_ :function(!shaka.util.FakeEvent)
Type:
- function(!shaka.util.FakeEvent)
playout_ :shaka.ads.InterstitialAdManager.Playout_
Playout of the interstitial being played. Only media actually played
counts, so loading or rebuffering its assets does not consume its
playout limit.
Type:
pollTimer_ :shaka.util.Timer
Type:
preloadOffsets_ :Map<string, number>
Preload hints (e.g. HLS "com.apple.hls.preload" Date Ranges, RFC 8216bis
Appendix F): maps the target ID to the time at which its resources may
start being resolved.
Type:
- Map<string, number>
preloadOnDomElements_ :Map<shaka.extern.AdInterstitial, !Array<!HTMLLinkElement>>
Type:
- Map<shaka.extern.AdInterstitial, !Array<!HTMLLinkElement>>
preloadTasks_ :Map<shaka.extern.AdInterstitial, shaka.ads.InterstitialPreloadTask>
Type:
presentationSignaling_ :shaka.ads.InterstitialAdManager.PresentationSignaling_
Type:
releaseStreaming_ :?function(number)
While playback starts in an ad break, the streaming of the content is
held, and this releases it with the position to start at.
Type:
- ?function(number)
sessions_ :Map<shaka.extern.AdInterstitial, shaka.ads.InterstitialAdSession>
Type:
sortedInterstitials_ :Array<shaka.extern.AdInterstitial>
Cache of interstitials_ sorted by descending start time, invalidated
(set to null) whenever interstitials_ changes. Avoids re-sorting on every
getCurrentInterstitial_ call (which runs per frame).
Type:
- Array<shaka.extern.AdInterstitial>
timeUpdateTimer_ :shaka.util.Timer
Type:
videoFrameCallbackHandler_ :shaka.util.VideoFrameCallbackHandler
Type:
Methods
clipPresented_(interstitialnon-null, presentednon-null, range) → {Array<!shaka.ads.InterstitialAdManager.PresentedAd>}
Clips the ads an interstitial is presented as to the part of its media
that is played, numbering them within it.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
presented |
Array<!shaka.ads.InterstitialAdManager.PresentedAd> | |
range |
{start: number, end: number} |
Returns:
- Type
- Array<!shaka.ads.InterstitialAdManager.PresentedAd>
getPlayableDuration_(interstitialnon-null) → {number}
How much of the media of an interstitial is played from its start, as
limited when its media is loaded.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- number
getReturnPosition_(interstitial, startPosition, elapsed) → {number}
Where the content returns to after a linear interstitial that started at
the given position of the content and played for the given time: the
resume offset after it, the end of the range it replaces when it is
clipped to it, and otherwise where the content would be now.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
startPosition |
number | |
elapsed |
number |
Returns:
- Type
- number
present_(interstitialnon-null, signalednon-null, duration) → {Array<!shaka.ads.InterstitialAdManager.PresentedAd>}
The ads an interstitial is presented as, given the ads signaled in its
presentation. An ad that covers the whole presentation describes the
interstitial itself. Otherwise each of them, and each part of the
presentation outside them, is presented as an ad of its own, identified
like the assets of an HLS asset list: grouped under the interstitial,
with an id of its own. The ads are clipped to the part of the
presentation that is played: the range of the interstitial on the
primary timeline, when clipped, and its playout limit.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
signaled |
Array<!shaka.ads.InterstitialAdManager.PresentedAd> | The signaled ads, with their ranges in the presentation. |
duration |
number | The duration of the presentation, or Infinity if it is not known. |
Returns:
- Type
- Array<!shaka.ads.InterstitialAdManager.PresentedAd>
addAdUrlInterstitial(url) → {Promise}
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string |
Returns:
- Type
- Promise
addDeferredInterstitial(descriptornon-null) → {Promise}
Registers a resource whose resolution is controlled by the common
scheduler. The resolver owns the resource's format and request details.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
shaka.extern.DeferredInterstitial |
Returns:
- Type
- Promise
addEventListeners_()
addInterstitials(interstitialsnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
interstitials |
Array<shaka.extern.AdInterstitial> |
addPreloadHint(targetId, startTime)
Advises that the resources of the interstitial (or deferred resource) with
the given ID may be resolved from the given time on. It is translated into
a resolutionTimeOffset, computed as the gap between the target's start
time and the hint's start time.
Parameters:
| Name | Type | Description |
|---|---|---|
targetId |
string | |
startTime |
number |
applyPreloadOffset_(item)
Sets resolutionTimeOffset from a matching preload hint, if any.
Parameters:
| Name | Type | Description |
|---|---|---|
item |
{id: ?string, groupId: (?string|undefined), startTime: number, resolutionTimeOffset: (number|undefined)} |
applyUpdatedPlayoutLimit_(interstitialnon-null, playoutLimit)
Applies a newly introduced playout limit to an interstitial. If the
interstitial is currently playing as a video ad, the playout-limit timer is
re-armed so the running ad is truncated.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
playoutLimit |
number |
canPresent_(interstitial) → {boolean}
Whether the interstitial can be presented with the current capabilities.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- boolean
checkForInterstitials_()
checkPreloadOnDomElements_(interstitialnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
checkStartInterstitials_()
Before playback starts, loads the interstitials of the ad break where it
is going to start, once that is known.
configure(config)
Called by the AdManager to provide an updated configuration any time it
changes.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
shaka.extern.AdsConfiguration |
createPreloadTask_(interstitialnon-null) → {shaka.ads.InterstitialPreloadTask}
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
createSession_(interstitialnon-null, adnon-null, videonon-null, onEvent) → {shaka.ads.InterstitialAdSession}
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
ad |
shaka.ads.InterstitialAd | |
video |
HTMLMediaElement | |
onEvent |
function(string) |
Returns:
cuepointsChanged_()
determineIfUsingBaseVideo_(forceopt)
Sets usingBaseVideo_ to true if the ad can be played with the base
video. Then, it either creates or destroys the media element of the
media asset, as appropriate.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
force |
boolean |
<optional> |
false | If true, re-create the media element of the media asset if it is appropriate for playback. |
endConcurrentAd_(interstitial, sequenceLength, adPosition, oncePlayed, timeOffset)
Moves on to the next interstitial of the ad break when a concurrent
presentation has ended, or ends the ad break.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
sequenceLength |
number | |
adPosition |
number | |
oncePlayed |
number | |
timeOffset |
number |
getCapabilities_() → {shaka.ads.InterstitialAdManager.Capabilities_}
What the device can present together with the primary content.
Returns:
getCurrentInterstitial_(needPreRollopt, numberToSkipopt, nullable) → {shaka.extern.AdInterstitial}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
needPreRoll |
boolean |
<optional> |
false | |
numberToSkip |
number |
<optional> <nullable> |
null |
Returns:
getExecutionDelta_(interstitial) → {number}
How late the execution of an interstitial starts if it starts now: the
time elapsed since its start (execution-delta, ISO/IEC 23009-1:2026,
5.16.2.2.6 and Annex I.4), 0 before its start and for pre-rolls and
post-rolls.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- number
getInterstitials() → {Array<shaka.extern.AdInterstitial>}
Only for testing
Returns:
- Type
- Array<shaka.extern.AdInterstitial>
getJoin_(interstitial, adPosition) → {{startTime: ?number, consumed: number}}
Where playback of the interstitial starts when it begins at the given
position of its sequence, and how much of its playout limit is already
consumed. Joining in the middle of an interstitial starts at the offset of
the join point unless startWithOffset is false, and consumes the time
elapsed since its start unless clip is false (ISO/IEC 23009-1:2026,
5.16.2.2.6).
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
adPosition |
number |
Returns:
- Type
- {startTime: ?number, consumed: number}
getPlayedRange_(interstitialnon-null, adPosition) → {{start: number, end: number}}
The range of the media of an interstitial that is played if it starts
now. Without clipping, the interstitial is not bound to its range on the
primary timeline. A clipped one ends with that range, so when it is
joined late only what is left of the range, or of its playout limit, is
played, from the start of the media or from the join position
(ISO/IEC 23009-1:2026, 5.16.2.2.6).
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
adPosition |
number |
Returns:
- Type
- {start: number, end: number}
getPosition_() → {number}
The position of the primary content. Before its first time update, it
is where playback is going to start: the live edge for live content, and
the start of the seek range otherwise. Null when that is not known yet,
because the presentation is still loading.
Returns:
- Type
- number
getRequestUri_(interstitial) → {string}
The URI to request an interstitial with. Its URL parameters are built
again with the current player state (ISO/IEC 23009-1 Annex I.4), since
the URI of the interstitial carries the values of an unknown state.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- string
getSortedInterstitials_() → {Array<shaka.extern.AdInterstitial>}
Returns interstitials_ sorted by descending start time, using a cache that
is invalidated whenever interstitials_ changes.
Returns:
- Type
- Array<shaka.extern.AdInterstitial>
getStartInterstitial_() → {shaka.extern.AdInterstitial}
The linear interstitial played first when playback starts where it is
going to start, if any.
Returns:
getTimeOffset_(interstitial) → {number}
The AD_BREAK_STARTED/ENDED time offset for an interstitial: 0 for pre-roll,
-1 for post-roll, otherwise its start time.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- number
getUrlParamState_(interstitial, name, key) → {string}
The value of a player state parameter (ISO/IEC 23009-1 Annex I.4) in a
request for the given interstitial, or null when it is not known. The key
is the id of the event the parameter refers to, which is not necessarily
the interstitial being requested.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
name |
string | |
key |
string |
Returns:
- Type
- string
interstitialId_(interstitial) → {string}
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- string
isInCooldown_() → {boolean}
Returns true if we are within the interstitialCooldown window that starts
after an SGAI interstitial ad break finishes playing. While active, any
snapback or next ad break should be skipped.
Returns:
- Type
- boolean
isPreloadAllowed_(interstitialnon-null) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- boolean
isSmartTV_() → {boolean}
Returns:
- Type
- boolean
isWithinPreloadWindow_(interstitialnon-null) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- boolean
makeAdRequest_(url, contextopt) → {shaka.net.NetworkingEngine.PendingRequest}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
url |
string | ||
context |
shaka.extern.RequestContext |
<optional> |
Returns:
maxJoinDelay_(interstitial) → {number}
How long after the start of an interstitial playback can still start it:
until its end when starting in the middle of interstitials is allowed,
without limit when it cannot be jumped over, and otherwise 1 second.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- number
onSeeked_()
onTimeUpdate_()
playMediaAd_(interstitial, presentednon-null, sequenceLength, adPosition, startTime, hooks) → {Promise}
Plays the media of an interstitial in the media asset: loads it, announces
and tracks its ads, and counts its playout. What depends on how the
interstitial is presented with the primary content is left to the hooks.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
presented |
Array<!shaka.ads.InterstitialAdManager.PresentedAd> | The ads presented in the media. |
sequenceLength |
number | |
adPosition |
number | |
startTime |
number | the clock time the interstitial started at |
hooks |
shaka.ads.InterstitialAdManager.MediaAdHooks_ |
Returns:
- Type
- Promise
preloadIfWithinWindow_(interstitialnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
readPresentedAds_(interstitial, adPosition) → {Promise<?Array<!shaka.ads.InterstitialAdManager.PresentedAd>>}
Reads the ads that the signaling in the presentation of the interstitial
describes, limited to the part of the media played from this join.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
adPosition |
number |
Returns:
The ads, or null if the ad break was stopped in the meantime.
- Type
- Promise<?Array<!shaka.ads.InterstitialAdManager.PresentedAd>>
readsPresentation_(interstitialnon-null) → {boolean}
Whether the ads of the interstitial are signaled in its presentation,
which is then parsed before they are announced. Only presentations with
a manifest can be parsed in advance.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
Returns:
- Type
- boolean
release()
Request that this object release all internal references.
- Implements:
- Source:
removeBaseStyles_(interstitialopt, nullable)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
<optional> <nullable> |
removeEventListeners_()
removeInterstitial_(interstitial)
Removes an interstitial and releases any resources associated with it
(preload tasks, preload-on-DOM link elements and bookkeeping sets).
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
removePreloadOnDomElements_(interstitialnon-null)
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
removeResolvedGroup_(groupIdnullable)
Removes the interstitials previously resolved from the resource with the
given group id, so the resource can be resolved again.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
groupId |
string |
<nullable> |
resetResourcesOnSeek_(currentTime)
On a seek into a live break, an already-resolved resource must be
re-requested with an updated playback offset that reflects the new
playhead position. Reset the cache of any resolved resource whose range
now contains the playhead so the poll resolves it again.
Parameters:
| Name | Type | Description |
|---|---|---|
currentTime |
number |
resolutionAheadTime_(item) → {number}
The look-ahead time (in seconds) used to decide how early an interstitial
is resolved/preloaded: the per-interstitial resolutionTimeOffset (DASH
earliestResolutionTimeOffset / HLS preload Date Range) when set, otherwise
the configured default.
Parameters:
| Name | Type | Description |
|---|---|---|
item |
{resolutionTimeOffset: (number|undefined)} |
Returns:
- Type
- number
resolveDeferredInterstitial_(descriptor)
Resolves a deferred resource descriptor and adds the resulting
interstitials. Invoked from the poll timer; not awaited.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
shaka.extern.DeferredInterstitial |
resolveInterstitialResource_(descriptornon-null) → {Promise<!Array<shaka.extern.AdInterstitial>>}
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
shaka.extern.DeferredInterstitial |
Returns:
- Type
- Promise<!Array<shaka.extern.AdInterstitial>>
retainResolvedResource_(descriptor)
After an resource resolves, either retain its descriptor (so a later seek
back into a live break can re-request it with an updated playback offset)
or drop it. Retaining is only useful for live streams that allow starting
in the middle of an interstitial.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
shaka.extern.DeferredInterstitial |
sendBeacon_(uri)
Parameters:
| Name | Type | Description |
|---|---|---|
uri |
string |
sendEvent_(type, dictopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
string | ||
dict |
Map<string, ?> |
<optional> |
sendEventForAd_(interstitialnon-null, type, dictopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
interstitial |
shaka.extern.AdInterstitial | ||
type |
string | ||
dict |
Map<string, ?> |
<optional> |
setBaseStyles_(interstitial)
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial |
setupAd_(interstitial, sequenceLength, adPosition, initialTime, oncePlayedopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |||
sequenceLength |
number | |||
adPosition |
number | |||
initialTime |
number | the clock time the ad started at | ||
oncePlayed |
number |
<optional> |
0 |
setupConcurrentAssetAd_(interstitial, sequenceLength, adPosition, oncePlayed)
Presents the image or the HTML document of a non-linear interstitial.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
sequenceLength |
number | |
adPosition |
number | |
oncePlayed |
number |
setupConcurrentMediaAd_(interstitial, sequenceLength, adPosition, oncePlayed) → {Promise}
Plays the media of a non-linear interstitial in a media element of its
own, over the primary content, which keeps playing.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
sequenceLength |
number | |
adPosition |
number | |
oncePlayed |
number |
Returns:
- Type
- Promise
setupLinearAd_(interstitial, sequenceLength, adPosition, initialTime, oncePlayed) → {Promise}
Plays a linear interstitial, which replaces the primary content.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
sequenceLength |
number | |
adPosition |
number | |
initialTime |
number | the clock time the ad started at |
oncePlayed |
number |
Returns:
- Type
- Promise
shouldResolveResourceNow_(descriptor) → {boolean}
Whether the given resource should be resolved immediately rather than
deferred until playback approaches it.
Parameters:
| Name | Type | Description |
|---|---|---|
descriptor |
shaka.extern.DeferredInterstitial |
Returns:
- Type
- boolean
shouldRetainResource_() → {boolean}
Whether resolved resources should be retained so they can be re-requested
after a seek. Only meaningful for live streams that allow starting in the
middle of an interstitial, where the playback offset would differ.
Returns:
- Type
- boolean
showMedia_(current, interstitial)
Shows the media element of the media asset where the interstitial is
presented.
Parameters:
| Name | Type | Description |
|---|---|---|
current |
shaka.extern.AdInterstitial | The ad being presented. |
interstitial |
shaka.extern.AdInterstitial |
startAdBreak_(interstitial, timeOffset)
Starts an ad break if none is being played.
Parameters:
| Name | Type | Description |
|---|---|---|
interstitial |
shaka.extern.AdInterstitial | |
timeOffset |
number |
startInAdBreak_()
When playback is going to start in an ad break that replaces the content
(e.g. a pre-roll, or a live stream joined during an ad break), the
content is not streamed until the ad break ends, so that what the ad
break replaces is neither fetched nor shown. The ad break starts as soon
as playback does.
stop()
Resets the Interstitial manager and removes any continuous polling.
stopEmbeddedInterstitial_(typenullable)
Ends the current embedded slot.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
string |
<nullable> |
The event that explains the end, if any. |
updateEmbeddedInterstitial_(seekedopt)
Updates embedded slots independently of the insertion scheduler. Loading
or seeking into a slot activates its half-open interval immediately;
insertion cooldown and snapback policies do not apply to existing media.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
seeked |
boolean |
<optional> |
false |
updateInterstitial(id, playoutLimit)
Applies a newly supplied playout limit to a scheduled ad or resource.
Existing limits remain unchanged.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | |
playoutLimit |
number |
Type Definitions
Capabilities_
Type:
- {concurrentVideo: number, concurrentImage: boolean}
Properties:
| Name | Type | Description |
|---|---|---|
concurrentVideo |
number | The number of videos that can be decoded and composed at the same time, the primary content included. |
concurrentImage |
boolean | Whether an image or an HTML document can be composed over the video. |
MediaAdHooks_
Type:
- {prepare: function(shaka.extern.AdInterstitial): !Promise, start: function(function(): !Promise), stop: function(shaka.extern.AdInterstitial, boolean, boolean): !Promise, onAdEvent: ?function(), onTimeUpdate: ?function()}
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
prepare |
function | Called with the ad being presented before the media is loaded, to make room for it. | |
start |
function | Called once the media is loaded, to start playing it. It is given the function that skips the media. | |
stop |
function | Called with the ad being presented, whether it was skipped and whether it failed to load with a bad HTTP status, once the media has ended. | |
onAdEvent |
function |
<nullable> |
Called before each event tracked for the ad being presented. |
onTimeUpdate |
function |
<nullable> |
Called as the media plays. |
Playout_
Type:
- {id: ?string, limit: number, played: number}
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
id |
string |
<nullable> |
The interstitial, or group of interstitials, the playout belongs to. |
limit |
number | The playout limit, in seconds, or Infinity. | |
played |
number | The media played so far, in seconds. |
PresentationSignaling_
Reads the signaling of the ads carried in the presentation of an
interstitial, such as SVTA2053 in a DASH list MPD or in an HLS asset
playlist, or the Periods of a DASH list MPD.
Type:
- {accepts: function(!shaka.extern.AdInterstitial): boolean, parse: function(!shaka.extern.AdInterstitial, !Array<shaka.extern.TimelineRegionInfo>, ?shaka.extern.Manifest): !Array<!shaka.ads.InterstitialAdManager.PresentedAd>}
Properties:
| Name | Type | Description |
|---|---|---|
accepts |
function | Whether the ads of the interstitial may be signaled in its presentation. |
parse |
function | Returns the ads signaled by the timeline regions and the manifest of the presentation, each one a copy of the interstitial that describes it. |
PresentedAd
An ad that an interstitial is presented as, with its range in the
presentation of the interstitial.
Type:
- {interstitial: !shaka.extern.AdInterstitial, start: number, end: ?number}
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
interstitial |
shaka.extern.AdInterstitial | The ad. It is the interstitial, or a copy of it that describes a part of its presentation. | |
start |
number | The start of the ad in the presentation, in seconds. | |
end |
number |
<nullable> |
The end of the ad in the presentation, in seconds, or null if the ad runs to the end of the presentation. |