【发布时间】:2015-08-03 11:11:36
【问题描述】:
嗯,我想在 MPMoviePlayer 中开始播放视频之前展示视频广告
这就是我正在做的:-
moviePlayer = [MPMoviePlayerController new];
moviePlayer.contentURL = [NSURL URLWithString:@"http://xyz/xyz.m3u8"];
[moviePlayer playPrerollAdWithCompletionHandler:^(NSError *error) {
// Check if error is non-nil during development
[moviePlayer play];
}];
moviePlayer.view.frame=CGRectMake(0, 20, 300, self.view.frame.size.width);
[self.view addSubview:moviePlayer.view];
[self.view layoutIfNeeded];
在 Appdelegate.m 中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[MPMoviePlayerController preparePrerollAds];
return YES;
}
但我还应该做些什么来展示广告视频或如何配置 iAD 以让应用了解将哪个特定视频作为广告播放。
目前该应用只是播放此网址“http://xyz/xyz.m3u8”的视频,但没有显示任何广告。
【问题讨论】:
标签: ios objective-c iphone ios7 iad