I have a navigation controller with a table view inside it that parses an .xml of m4v video podcast. When the item is selected, it pushes VideoWebView View Controller onto the navigation controller, and the code for that viewDidLoad is:
The movie plays just fine, but does not take up all the screen. The tab bar still shows, the navigation bar still shows. I also cannot get it to pull up any video controls when I tap the screen. A screenshot is attached below:
Code:
- (void)viewDidLoad {
self.title = _entry.articleTitle;
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
[audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
if (setCategoryError) { /* handle the error condition */ }
NSError *activationError = nil;
[audioSession setActive:YES error:&activationError];
if (activationError) { /* handle the error condition */ }
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
NSURL *newURL = [NSURL URLWithString:_entry.articleUrl];
self.player = [[MPMoviePlayerController alloc] initWithContentURL: newURL];
[player prepareToPlay];
player.allowsAirPlay = YES;
player.scalingMode = MPMovieScalingModeAspectFit;
self.player.view.frame = self.view.frame;
[self.view addSubview: player.view];
[self.player setFullscreen:YES animated:YES];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:player];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateChanged:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:player];
[player play];
[super viewDidLoad];
}