I am trying to create an UIViewController
with some labels and a movie in the middle of the screen. For the movie, I am using AVPlayerViewController
but, whenever I click on its fullscreen button, I receive several constraint warnings even if I create the AVPLayerViewController
from code, using CGRect
for defining its bounds or if I embed it in a ContainerView using storyboard.
This is the code I am using when I don't rely in storyboard:
NSString *path = [[NSBundle mainBundle] pathForResource:@"video_1" ofType:@"3gp"];
NSURL *movieURL = [NSURL fileURLWithPath:path];
AVPlayer *player = [AVPlayer playerWithURL:movieURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = player;
[self addChildViewController:playerViewController];
[self.view addSubview:playerViewController.view];
playerViewController.view.frame = CGRectMake(100, 100, 640, 480);
[player play];
Does anyone know how to fix the constraint issues?
Thank you