Optional customCustom attributes mapping callback to map tracking payload data to interstitial tracking registry
Parsed tracking data present in the interstitial tags
Registry to register tracking events
Example:
const playerConfig = {
hls: {
interstitials: {
customAttributesMapping(mappingData, mappingRegistry) {
const adCreativeSignaling = mappingData.customAttributes['X-AD-CREATIVE-SIGNALING'];
const payload = adCreativeSignaling.payload;
if (!payload) {
return;
}
const firstPayload = payload[0];
const clickThroughUrl = firstPayload.clickThrough;
if (clickThroughUrl) {
mappingRegistry.clickThroughUrl = clickThroughUrl;
}
const trackingData = firstPayload.tracking;
if (trackingData) {
for (const trackingEvent of trackingData) {
const eventType = trackingEvent.type;
const urls = trackingEvent.urls;
const offset = trackingEvent.offset;
if (!eventType || !urls) {
continue;
}
switch (eventType) {
case InterstitialTrackingEventTrigger.IMPRESSION:
mappingRegistry.tracking.register(
InterstitialTrackingEventTrigger.IMPRESSION,
{ urls, offset },
);
break;
}
}
}
},
},
},
};
Optional customPreset for standard custom attributes mapping When set, the player will automatically map standard custom attributes based on the selected preset.
Default is CustomAttributesMappingPresets.NONE
When InterstitialsConfig.customAttributesMapping is set, this property is ignored.
When set to CustomAttributesMappingPresets.AD_CREATIVE_SIGNALING, SVTA "X-AD-CREATIVE-SIGNALING" mapping is applied.
Optional shouldCallback to determine if an interstitial ASSET-LIST should be loaded. The callback will be called for every interstitial ASSET-LIST before loading.
The interstitial to be evaluated
Whether the interstitial should be loaded
Example:
const playerConfig = {
hls: {
interstitials: {
shouldLoadInterstitial: (interstitial) => {
// Only load interstitials with a specific id
return interstitial.id === 'pre-roll-1';
},
},
},
};
Optional shouldCallback to determine if an interstitial should be played. The callback will be called for every interstitial before playback.
The interstitial to be evaluated
Whether the interstitial should be played
Example:
const playerConfig = {
hls: {
interstitials: {
shouldPlayInterstitial: (interstitial) => {
// Only play interstitials with a specific id
return interstitial.id === 'pre-roll-1';
},
},
},
};
Optional shouldCallback to determine which interstitials should be played when multiple interstitials are skipped using jump
A list of interstitials to be evaluated
The start time of the jump operation in seconds
The end time of the jump operation in seconds
A filtered list of interstitials that should be played
Example:
const playerConfig = {
hls: {
interstitials: {
shouldPlayJumpedOverInterstitials: (interstitials, fromTime, toTime) => {
// Play only interstitials with duration greater than 15 seconds
return interstitials.filter(interstitial => interstitial.duration > 15);
},
},
},
};
Configuration options for HLS interstitials handling