我已经实现了iAd的Preroll视频广告,我想保证我的用户将观看整个广告。如何隐藏AVPlayerViewController的控制栏,使用户不能点击“完成”,并在视频结束前退出?
self.canDisplayBannerAds = YES;
[AVPlayerViewController preparePrerollAds];
player = [[AVPlayerViewController alloc] init];
player.showsPlaybackControls = NO;
player.delegate = self;发布于 2016-03-03 03:36:58
您可以使用此代码来执行相同的操作。您需要在呈现控制器时调用play。
playerItem = [[AVPlayerItem alloc] initWithURL:url];
if(playerItem) {
player = [[AVPlayer alloc] initWithPlayerItem:playerItem];
playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.player = _player;
[playerViewController setShowsPlaybackControls:NO];
[parentViewController presentViewController:playerViewController animated:YES completion:^{
[playerViewController.player play];
}];发布于 2016-11-25 20:55:53
简单的代码
// create an AVPlayer
AVPlayer *player = [AVPlayer playerWithURL:videoURL];
// create a player view controller
AVPlayerViewController *controller = [[AVPlayerViewController alloc]init];
controller.player = player;
controller.showsPlaybackControls = FALSE;https://stackoverflow.com/questions/33828940
复制相似问题