5

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

controls of the AVPlayerViewController player

Player's 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 a 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 the button. Is there a way to disable just the single button, or get the array of the default toolbar buttons and disable a specific one.

Vladimír Slavík
  • 1,727
  • 1
  • 21
  • 31
  • what about rolling your own AVPlayer implementtion? It's pretty simple and you can add custom controls as you wish – Larry Pickles Dec 01 '15 at 19:12
  • @Larcerax I have updated the question.Thank you. – Vladimír Slavík Dec 04 '15 at 13:49
  • Possible duplicate of [How to perform some action on Play and Pause actions of AVPlayer?](http://stackoverflow.com/questions/34038368/how-to-perform-some-action-on-play-and-pause-actions-of-avplayer) – rkyr Dec 04 '15 at 13:55
  • @rkyr I am using the AVPlayerViewController not just the AVPlayer within a custom controller. – Vladimír Slavík Dec 06 '15 at 16:30
  • @VladimírSlavík linked question also about AVPlayerVeiwController – rkyr Dec 06 '15 at 16:33
  • Also if subtitles view controller is presented, there is no "Done" or "Cancel" button to disable it. If one tap at the top right, the subtitles view controller is dismissed. – user3404693 Apr 01 '16 at 10:46

1 Answers1

0

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

You need to explicitly declare that the content does not contain closed captions (with CLOSED-CAPTIONS=NONE, full details in the note above)

Ron
  • 1