Video interstitial integration

Last updated on June 6, 2019

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 Android SDK. The supported video ad formats include .mp4, .3gpp, .webm, and .mkv.




Data enrichment


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. Update your Android manifest, as described in Android SDK integration.


Some integration steps vary as indicated, depending on which OpenX Mobile SDK version you are using.

  1. To create a video interstitial ad, create a new object of the type AdView as shown below.
  2. public class MainActivity extends Activity {
    	private AdView mAdViewVideo;
    	protected void onCreate(Bundle savedInstanceState) {
    	private void loadAd() {
    		try {
    			// For OpenX mobile SDK version 4.9 or later:
    			mInterstitialView = new InterstitialView(this,””, “123456789”, InterstitialView.AdType.VAST);		
    			// For OpenX mobile SDK versions earlier than 4.90:		
    			mAdViewVideo = new AdView(this, "");
    		catch (AdException e) {
    			Log.e(TAG, "Something went wrong! Error: " + e.getMessage());
  3. Set AutoDisplayOnLoad to false to avoid displaying the video right after it finishes loading.


  4. Set the opacity of the video frame. The recommended value is 1.0f (opaque).
  5. Use InterstitialVideoProperties to set video properties.
    1. Create an InterstitialVideoProperties object:

      InterstitialVideoProperties properties = new InterstitialVideoProperties();

    2. In OpenX Mobile SDK versions earlier than 4.9 only: For a better user experience, preload the video as shown below. By default, preLoadVideo is set to true, but if you still prefer to stream the video, set preLoadVideo to false. Note that the SDK will not preload video ads larger than 25 MiB.

      properties.preloadVideo = true;
    3. In OpenX Mobile SDK versions earlier than 4.9 only: Use autoPreloadConfigs to specify the network scenario where the video is to be preloaded. The default is Wi-Fi only.
      properties.autoPreloadConfigs = VideoProperties.AutoVideoPreloadConfigs.WifiOnlyAutoPreload;
    4. Use closeButtonDelayinSecs to display the Close button on the video ad at the desired interval.
      • 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 the 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


      <= 2

      Ignored End of video

      > 2

      Nil, value < 22

      > 2

      2 <= value <= upper limit Value

      > 2

      Value > upper limit Upper limit


    5. After you have set the video properties, attach them to AdView.

  6. Create and attach AdEventsListener to AdView to get the life cycle events of the ad. For details on available events, see Callbacks.

    mAdViewVideo.addAdEventListener(new AdEventsListener() {
    	public void adDidLoad(AdView adView, AdDetails adDetails) {
  7. Load the ad.
  8. At any point after the ad is loaded, which is indicated by the adDidLoad() event being called inside your AdEventsListener, you can display the ad.
  9. Be sure to destroy the AdView object during the cleanup.
    protected void onDestroy() {
    	if (null != adViewVideo) {
    		mAdViewVideo = null;

Data enrichment

For information about enriching data in the ad requestCommunication from a web browser or app to an ad server to display an ad., please see Parameters.

Fill out my online form.