当前位置:  开发笔记 > IOS > 正文

如何在AVPlayerViewController中禁用音频和字幕设置

如何解决《如何在AVPlayerViewController中禁用音频和字幕设置》经验,为你挑选了0个好方法。

我想从播放器(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视频中的示例不包含该按钮。有没有一种方法可以仅禁用单个按钮,或者获取默认工具栏按钮的数组并禁用特定按钮。

推荐阅读
雨天是最美
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有