I've looked and found some similar questions asked before. But none of the offered solutions work for me so I'm asking this.
I'm writing an IOS App that starts with a Tab bar, each tab View Controller has an embedded Navigation Controller. I am able to stream video and play it using AVPlayerViewController but am not able to force it to start in Landscape mode (even if the phone is in portrait mode. If I flip the phone, it does become full screen as Landscape mode.
Here is the code section that I have that streams the Video:
-(void) startPlayback {
NSURL *streamURL = [NSURL URLWithString: pathToVideoStream];
NSLog(@"Entered %s - Will now try to play video at NSURL: %@",__PRETTY_FUNCTION__, streamURL );
AVPlayerViewController *moviePlayer = [[AVPlayerViewController alloc] init];
moviePlayer.player = [AVPlayer playerWithURL:streamURL];
[self presentViewController:moviePlayer animated:YES completion:nil];
moviePlayer.view.frame = self.view.frame;
[moviePlayer.player play];
}
I have added the suggestions from this post: Play Video In Landscape when entire application is Portait
But that did not force the video to play in Landscape mode. I see other suggestions about using CGAffine, but my first instinct says that can't be the correct way to flip the Video. Please advice.