Bitmovin Player API 8.268.0
    Preparing search index...

    Interface InterstitialsConfig

    Configuration options for HLS interstitials handling

    interface InterstitialsConfig {
        customAttributesMapping?: (
            mappingData:
                | InterstitialData
                | InterstitialAssetListData
                | InterstitialAssetData,
            mappingRegistry: InterstitialCustomAttributesMappingRegistry,
        ) => void;
        customAttributesMappingPreset?: CustomAttributesMappingPresets;
        shouldLoadInterstitial?: (interstitial: HlsInterstitial) => boolean;
        shouldPlayInterstitial?: (interstitial: HlsInterstitial) => boolean;
        shouldPlayJumpedOverInterstitials?: (
            interstitials: HlsInterstitial[],
            fromTime: number,
            toTime: number,
        ) => HlsInterstitial[];
        viewability?: InterstitialViewabilityConfig;
    }
    Index
    customAttributesMapping?: (
        mappingData:
            | InterstitialData
            | InterstitialAssetListData
            | InterstitialAssetData,
        mappingRegistry: InterstitialCustomAttributesMappingRegistry,
    ) => void

    Custom attributes mapping callback to map tracking payload data to interstitial tracking registry

    Type Declaration

      • (
            mappingData:
                | InterstitialData
                | InterstitialAssetListData
                | InterstitialAssetData,
            mappingRegistry: InterstitialCustomAttributesMappingRegistry,
        ): void
      • Parameters

        • mappingData: InterstitialData | InterstitialAssetListData | InterstitialAssetData

          Parsed tracking data present in the interstitial tags

        • mappingRegistry: InterstitialCustomAttributesMappingRegistry

          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;
          }
          }
          }
          },
          },
          },
          };

        Returns void

    customAttributesMappingPreset?: CustomAttributesMappingPresets

    Preset 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.

    shouldLoadInterstitial?: (interstitial: HlsInterstitial) => boolean

    Callback to determine if an interstitial ASSET-LIST should be loaded. The callback will be called for every interstitial ASSET-LIST before loading.

    Type Declaration

      • (interstitial: HlsInterstitial): boolean
      • Parameters

        Returns boolean

        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';
        },
        },
        },
        };
    shouldPlayInterstitial?: (interstitial: HlsInterstitial) => boolean

    Callback to determine if an interstitial should be played. The callback will be called for every interstitial before playback.

    Type Declaration

      • (interstitial: HlsInterstitial): boolean
      • Parameters

        Returns boolean

        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';
        },
        },
        },
        };
    shouldPlayJumpedOverInterstitials?: (
        interstitials: HlsInterstitial[],
        fromTime: number,
        toTime: number,
    ) => HlsInterstitial[]

    Callback to determine which interstitials should be played when multiple interstitials are skipped using jump

    Type Declaration

      • (
            interstitials: HlsInterstitial[],
            fromTime: number,
            toTime: number,
        ): HlsInterstitial[]
      • Parameters

        • interstitials: HlsInterstitial[]

          A list of interstitials to be evaluated

        • fromTime: number

          The start time of the jump operation in seconds

        • toTime: number

          The end time of the jump operation in seconds

        Returns HlsInterstitial[]

        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);
        },
        },
        },
        };

    Viewability tracking configuration for SGAI interstitial ads.