Video interstitial integration

Last updated on August 28, 2018

You can integrate video interstitialA full-screen ad displayed in content transitions. For example, a video ad that loads between levels of a mobile game. ads in the OpenX Mobile iOS SDK. The supported video ad formats include .mp4, .3gpp, .webm, and .mkv.

Overview

Prerequisites

Integration

Objective-C code sample

Swift code sample

Prerequisites

Before integrating a video interstitial ad in your app, please do the following:

  1. Either create a linear video ad unit or make sure you know which existing ad unitThe smallest inventory component that represents the space on a site where ads display. to use.
  2. Complete the integration steps, as described in Integrating the SDK with your app.

Integration

Note: If you are using Interface Builder to assist with your ad integration, set up OXMInterstitialController in Interface Builder before following the steps below.

  1. In your view controller, import OpenXSDKCore.

  2. Conform your view controller to the OXMInterstitialControllerDelegate protocol.
  3. Create a variable to reference OXMInterstitialController and instantiate it.
  4. In your view controller, set parameters in the viewDidLoad method:

    1. Set adUnitIdentifierType to AdUnitIdentifierTypeVast.
    2. Set vastURL using the URL from your video ad unit. Please note that a VAST tag always looks like this: "DOMAIN/v/1.0/av?auid=AUID" (where DOMAIN is your OpenX delivery domainThe domain on which ads will be served for your OpenX inventory. OpenX Partner Services provide this to you so you can set up your implementation. For example: PUBLISHER-d.openx.net., and AUID is the OpenX ad unit ID).
    3. Assign delegate and set it to self.
    4. Set autoDisplayOnLoad to false.
    5. (Recommended) Enrich the request by setting values on the userParameters property.

    Note: OpenX SDK preloads video content by default.

  5. If needed, set the desired closeDelay on OXMInterstitialDisplayProperties.

    • Videos that span 2 seconds or less cannot be closed early.
    • Videos longer than 2 seconds will display a Close button at 2 seconds by default (recommended).

    If you prefer customizing video duration, set the limits as described below. All values are in seconds.

    Note: The upper limit is the end of video or 30 seconds, whichever is less.

     

    Video ad duration

    Custom value

    Result

    <= 2

    Ignored End of video

    > 2

    Nil, value < 2 2

    > 2

    2 <= value <= upper limit Value

    > 2

    Value > upper limit Upper limit
  6.  

  7. Call load() on OXMInterstitialController.
  8. Implement the OXMInterstitialControllerDelegate methods.
  9. Display the video interstitial.

Objective-C code sample

Swift code sample

Fill out my online form.