Interstitial Video

app_show_type:50004

Interstitial video ads are full-screen video ads that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial video ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

Import Header Files

// if CheetahMobileAds.framework
@import CheetahMobileAds;

// else if CheetahMobileAds.a
#import "CMARequestError.h"
#import "CMAInterstitialVideoAd.h"

Set up event notifications

@interface InterstitialVideoViewController ()<CMAInterstitialVideoAdDelegate>

// setup delegate
self.interstitialVideoAd.delegate = self;

The following sample illustrates how to log each of the events available in CMAInterstitialVideoAdDelegate:.

- (void)interstitialVideoAdDidReceiveAd:(CMAInterstitialVideoAd *)interstitialVideoAd;
- (void)interstitialVideoAd:(CMAInterstitialVideoAd )interstitialVideoAd didFailToLoadWithError:(CMARequestError )error;
- (void)interstitialVideoAdDidOpen:(CMAInterstitialVideoAd *)interstitialVideoAd;
- (void)interstitialVideoAdDidStartPlaying:(CMAInterstitialVideoAd *)interstitialVideoAd;
- (void)interstitialVideoAdWillClose:(CMAInterstitialVideoAd *)interstitialVideoAd;
- (void)interstitialVideoAdWillLeaveApplication:(CMAInterstitialVideoAd *)interstitialVideoAd;

Declare InterstitialVideoAd

@property (nonatomic, strong)CMAInterstitialVideoAd *interstitialVideoAd;

Setup POSID

CMAPosIDConfig *posIDConfig = [[CMAPosIDConfig alloc] 
        initWithOrionPosID:@"YOUR_POSID" liehuPosID:@"YOUR_POSID_FOR_CHINA"];

Initialize Interstitial Video Ads

self.interstitialVideoAd = 
    [[CMAInterstitialVideoAd alloc] initWithPosIDConfig:posIDConfig];

Load Ads

[self.interstitialVideoAd loadAd];

Check if the Ad is ready.

if (self.interstitialVideoAd.isReady) {
    NSLog(@"Ready to show Ad");
}

Show Ads

// Need to check if the video ad is ready or not. 
if (self.interstitialVideoAd.isReady) 
{ 
    [self.interstitialVideoAd presentFromRootViewController:self]; 
}

Last updated