Search code examples
iosiphonempmovieplayercontrolleriad

playPrerollAdWithCompletionHandler issue


I configure a MPMoviewPlayerController to display iAd before I play a video. So basicaly my code looks like this

player = [MPMoviePlayerController new];
player.contentURL = videoURL;    
[player playPrerollAdWithCompletionHandler:^(NSError *error) {
    NSLog(@"error playing ad %@", error.userInfo);
    [player play];
}];

[self.contentView addSubview:player.view];
[self.contentView layoutIfNeeded];

And in AppDelegate

[MPMoviePlayerController preparePrerollAds];

But the problem is that i receive the sound, but player does not display a video. Also I don't get any error in completion handler… Any help is very appreciated!


Solution

  • For me it only works when the player is set to fullscreen.

    [parent.view addSubview: player.view];
    [parent.view bringSubviewToFront:player.view];
    [player setFullscreen:YES animated:YES];