I display video in this way.
the problem is user can rotate the application while video is played. I want the video to be played only in portrait mode. How it could be done ?
Code:
NSURL *url = [NSURL URLWithString:banner.link];
AVURLAsset *asset = [AVURLAsset assetWithURL: url];
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset: asset];
AVPlayer * player = [[AVPlayer alloc] initWithPlayerItem:item];
self.playerViewController.player = player;
self.playerViewController.showsPlaybackControls = true;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:player.currentItem];
[self.playerViewController.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
self.playerViewController.showsPlaybackControls = true;
// [self.view addSubview:self.playerViewController.view];
[self presentViewController:self.playerViewController animated:true completion:nil];
[player play];