How to disable audio and subtitle settings in AVPlayerViewController

I want to remove the audio and subtitle settings button from the player (iOS8, iOS9):

AVPlayerViewController player controls

Player controller initialization:

            - (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]];
                }

            }

When the stream URL is received, it is passed to the new player instance:

 self.moviePlayerController.player = [AVPlayer playerWithURL:self.contentUrl];
 //self.moviePlayerController.showsPlaybackControls = YES;
 if([self.moviePlayerController respondsToSelector:@selector(allowsPictureInPicturePlayback)]) {                             

    self.moviePlayerController.allowsPictureInPicturePlayback = YES;
}

The example in the WWDC video does not contain a button. Is there a way to disable only one button or get an array of toolbar buttons by default and disable a specific one.

+4
source share
1 answer

In our case, the information here removed the unwanted button https://developer.apple.com/library/content/qa/qa1801/_index.html

, ( CLOSED-CAPTIONS = NONE, )

0

Source: https://habr.com/ru/post/1618162/


All Articles