Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface AdvertisingConfig

Simple example:

advertising: {
  client          : 'vast',
  tag             : 'http://your.ad.provider/manifest.xml'
}

This is the most simple config example to play a single pre-roll ad.

Advanced example:

advertising: {
  admessage: 'This ad will end in {remainingTime} seconds',
  skipmessage: {
    countdown: 'Skip in {remainingTime} seconds...',
    skip: 'SKIP'
  },
  schedule: {
    'pre-roll-ad': {
      client: 'vast',
      offset: 'pre',
      tag: 'http://your.ad.provider/pre-roll-ad-manifest.xml'
    },
    'mid-roll-ad': {
      client: 'vpaid',
      offset: '50%',
      tag: 'http://your.ad.provider/mid-roll-ad-manifest.xml'
    }
  }
}

This example plays a pre-roll and a mid-roll ad after 50% of the playback and displays custom countdown messages to the user (if used with the default UI).

Hierarchy

  • AdvertisingConfig

Index

Properties

Optional adCallOffset

adCallOffset: number

Specifies the time in seconds, how much the VAST tag is loaded prior to the ad playback. By default the VAST tag is loaded at player startup.

Optional admessage

admessage: string

Defines a custom message that will be displayed to the user instead of the progress bar during ad playback.

Has the placeholders '{remainingTime[formatString]}', '{playedTime[formatString]}' and '{adDuration[formatString]}', which are replaced by the remaining time until the ad can be skipped, the current time or the ad duration. The format string is optional. If not specified, the placeholder is replaced by the time in seconds. If specified, it must be of the following format:

  • %d - Inserts the time as an integer.
  • %0Nd - Inserts the time as an integer with leading zeroes, if the length of the time string is smaller than N.
  • %f - Inserts the time as a float.
  • %0Nf - Inserts the time as a float with leading zeroes.
  • %.Mf - Inserts the time as a float with M decimal places. Can be combined with %0Nf, e.g. %04.2f (the time 10.123 would be printed as 0010.12).
  • %hh:mm:ss
  • %mm:ss

Optional allowSeekingOverMidRollAds

allowSeekingOverMidRollAds: boolean

If set to true, mid-roll ads are only played during normal playback. Seeking to a time after the mid-roll ads doesn't trigger ad playback.

since

7.1

client

client: AdClient

Mandatory. Specifies which ad client to use.

Optional offset

offset: string

Defines when the ad shall be played.

Allowed values are:

  • 'pre': pre-roll ad
  • 'post': post-roll ad
  • fractional seconds: '10', '12.5' (mid-roll ad)
  • percentage of the entire video duration: '25%', '50%' (mid-roll ad)
  • timecode [hh:mm:ss.mmm]: '00:10:30.000', '01:00:00.000' (mid-roll ad)

Optional placeholders

placeholders: AdTagPlaceholders

List of placeholder strings that will be replaced in the ad manifest URL with the corresponding values.

since

7.8.7

ready

ready: function

Is called when the AdManager is loaded and ready and results in an AdReady object. Only available for the 'ima' client

param
since

7.7

Type declaration

Optional schedule

schedule: object

Contains one or more ad breaks. Each ad break defines when an ad shall be played and must contain an offset and a tag property.

Type declaration

setup

setup: function

Is called during the advertisement implementation setup and results in a AdConfig. Only available for the 'ima' client.

param

Information about the ad client and its configuration.

returns

Resulting ad config that is passed to the ad implementation.

since

7.7

Type declaration

Optional skipmessage

skipmessage: SkipMessage

Defines a custom message that will be displayed to the user as a skip button.

Optional tag

tag: string | AdManifest[]

Defines the path to an ad manifest. Can be used to schedule a single ad without setting the schedule property, that will be played at the time defined in the offset property. It will be played as pre-roll add by default if no offset is set, or when a schedule with additional ads is provided. The array is used for ad waterfalling: all entries beyond the first are fallbacks if the previous ones did not work.

Optional withCredentials

withCredentials: boolean

Specifies that cookies are send along with the ad request. The server needs to explicitly accept them for CORS requests, otherwise the request will fail.

Generated using TypeDoc