我想从播放器(iOS8,iOS9)中删除音频和字幕设置按钮:
播放器的控制器初始化:
- (void) configureMoviePlayer {
if(self.moviePlayerController == nil) {
self.moviePlayerController = [[AVPlayerViewController alloc] init];
[self.view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.moviePlayerController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview: [self.moviePlayerController view]];
NSDictionary *views = @{ @"selfview" : self.view, @"movieControllerView" : [self moviePlayerController].view};
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[movieControllerView]|"
options:0
metrics:nil
views:views]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[movieControllerView]|"
options:0
metrics:nil
views:views]];
}
}
当接收到流 URL 时,它被传递给一个新的播放器实例:
self.moviePlayerController.player = [AVPlayer playerWithURL:self.contentUrl];
//self.moviePlayerController.showsPlaybackControls = YES;
if([self.moviePlayerController respondsToSelector:@selector(allowsPictureInPicturePlayback)]) {
self.moviePlayerController.allowsPictureInPicturePlayback = YES;
}
WWDC 视频中的示例不包含该按钮。有没有办法只禁用单个按钮,或者获取默认工具栏按钮的数组并禁用特定按钮。