Companion banner ads

TVSDK supports companion banner ads, which are ads that accompany a linear ad and often remain on the page after the linear ad ends. Your application is responsible for displaying the companion banners that are provided with a linear ad.

When displaying companion ads, follow these recommendations:

  • Attempt to present as many of a video ad’s companion banner ads as will fit in your player’s layout.

  • Present a companion banner only if you have a location that exactly matches its specified height and width.


    Do not resize the banner.

  • Present the companion banner(s) as soon as possible after the ad begins.

  • Do not overlay the main ad/video container with companion banners.

  • Continue to display companion banners after the ad ends.

    The standard is to display each companion banner until you have a replacement for this banner.

Companion banner data

The content of a PTAdAsset describes a companion banner.

The PTMediaPlayerAdStartedNotification notification returns a PTAd instance that contains a companionAssets property (array of PtAdAsset).
Each PtAdAsset provides information about displaying the asset.

Available information Description
width Width of the companion banner in pixels.
height Height of the companion banner in pixels.
resource type The resource type for this companion banner:
  • html: The data is in HTML code.
  • iframe: The data is an iframe URL (src).
  • static: The data is a staticURL that is a direct URL to an image.
data The data of the type that is specified by resourceType for this companion banner.

Display banner ads

To display banner ads, you need to create banner instances and allow TVSDK to listen for ad-related events.

TVSDK provides a list of companion banner ads that are associated with a linear ad through the PTMediaPlayerAdPlayStartedNotification notification event.

Manifests can specify companion banner ads by:

  • An HTML snippet
  • The URL of an iFrame page
  • The URL of a static image or an Adobe Flash SWF file

For each companion ad, TVSDK indicates which types are available for your application.

  1. Create a PTAdBannerView instance for each companion ad slot on your page.

    Ensure that the following information has been provided:
    • To prevent the retrieval of companion ads of different sizes, a banner instance that specifies the width and height.
    • Standard banner sizes.
  2. Add an observer for the PTMediaPlayerAdStartedNotification that does the following:

    1. Clears existing ads in the banner instance.

    2. Gets the list of companion ads from Ad.getCompanionAssets PTAd.companionAssets.

    3. If the list of companion ads is not empty, iterate over the list for banner instances.

      Each banner instance ( a PTAdAsset) contains information, such as width, height, resource type (html, iframe, or static), and data that is required to display the companion banner.

    4. If a video ad has no companion ads booked with it, the list of companion assets contains no data for that video ad.

      To show a standalone display ad, add the logic to your script to run a normal DFP (DoubleClick for Publishers) display ad tag in the appropriate banner instance.

    5. Sends the banner information to a function on your page that displays the banners in an appropriate location.

      This is usually a div, and your function uses the div ID to display the banner. For example:

      - (void) onMediaPlayerAdPlayStarted:(NSNotification *) notification {
          _currentAd  = [notification.userInfo  objectForKey:PTMediaPlayerAdKey];
          if (_currentAd != nil) {
              [self removeAllBanners]; // remove any existing PTAdBannerView views
              // banners
              if (_currentAd.companionAssets && _currentAd.companionAssets.count > 0) {
                  PTAdAsset *bannerAsset = [_currentAd.companionAssets objectAtIndex:0];
                  PTAdBannerView *bannerView = [[PTAdBannerView alloc] initWithAsset:bannerAsset];
                  bannerView.player = self.player;
                  bannerView.delegate = self;
                  bannerView.frame = CGRectMake(0.0, 0.0, bannerAsset.width, bannerAsset.height);
                  [_adBannerView.bannerView addSubview:bannerView];

On this page