Unable to simultaneously satisfy constraints Warnings with AVPlayerViewController embedded in storyboard

In fact, I think it’s bug on Apple side.

I found a workaround : set showsPlaybackControls to YES after the AVPlayerViewController.player have been set.

I modify your sample with the following lines and no more Constraint error appears :

@interface ViewController ()

@property(weak, nonatomic) AVPlayerViewController * playerViewController;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
    NSURL *url = [[NSURL alloc] initFileURLWithPath: path];
    AVPlayer * player = [AVPlayer playerWithURL:url];

    self.playerViewController.player = player;
    self.playerViewController.showsPlaybackControls = YES;
}


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"AVPlayerSegue"]) {
        self.playerViewController = segue.destinationViewController;
    }
}


@end

Please note that the file test.mp4 have been added to the project.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)