Implementing pre-roll video iAds

| | August 10, 2015

In October 2014 Apple announced pre-roll video as a new ad format for iAd

However, there is no official documentation on implementing them. Is this format available yet and if so how can they be implemented?

One Response to “Implementing pre-roll video iAds”

  1. Check my example for a working implementation of iAd’s prerolled video ads:

    #import "ViewController.h"
    @import iAd;
    @import MediaPlayer;
    @interface ViewController () {
        MPMoviePlayerController *moviePlayer;
    @implementation ViewController
    -(void)viewDidLoad {
        [super viewDidLoad];
        // Preload ad
        [MPMoviePlayerController preparePrerollAds];
        // Create our MPMoviePlayerController
        moviePlayer =[[MPMoviePlayerController alloc]init];
        [moviePlayer.view setFrame: self.view.bounds];
        [moviePlayer setFullscreen:YES animated:YES];
    -(IBAction)playButton:(id)sender {
        // Add MPMoviePlayerController to our view
        [self.view addSubview:moviePlayer.view];
        // Path of movie you want to play
        NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"someVideo" ofType:@"MOV"];
        // Set the contents of our MPMoviePlayerController to our path
        [moviePlayer setContentURL:[NSURL fileURLWithPath:moviePath]];
        // Prepare our movie for playback
        [moviePlayer prepareToPlay];
        // Play our movie with a prerolled ad
        [moviePlayer playPrerollAdWithCompletionHandler:^(NSError *error) {
            [moviePlayer play];

Leave a Reply