MPMoviePlayerController fullscreen mode issue
I have a problem with my code that plays a video file. Whenever I play the file in fullscreen mode the playback doesn’t occupy all of my screen. Here is the relevant code:
NSURL *url = [NSURL fileURLWithPath:@"Somefile.mov"]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [moviePlayer setControlStyle:MPMovieControlStyleFullscreen]; [moviePlayer setFullscreen:YES]; moviePlayer.view.frame = self.switchView.frame; [self.switchView addSubview:moviePlayer.view]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackStateDidChange:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:moviePlayer]; [moviePlayer prepareToPlay]; [moviePlayer play];
Here is the output I get:
- MPMoviePlayer setCurrentPlaybackTime iOS
- Play YouTube videos with MPMoviePlayerController instead of UIWebView
- NSURLConnection finished with error - code -1002
- UIImagePickerController choosing video prevents MPMoviePlayerViewController instance from working
- How to Open Youtube video in MPMoviePlayerController and Play it
- Continue playing movie in MPMoviePlayerViewController in background
2 Solutions Collect From Internet About “MPMoviePlayerController fullscreen mode issue”
Option A: Use the
MPMovieViewController instead and display it modally using
Option B: Make sure your switchView (which you use for adding the moviePlayer’s view to) actually occupies the entire screen.
Option C: Readjust the frame of the moviePlayer’s view with negative vertical offsets until it fits – eg.:
moviePlayer.view.frame = CGRectMake(0.0f, -20.0f, 320.0f, 480.0f);
Note: MPMoviePlayerController always displays a status bar when using the control style
MPMovieControlStyleFullscreen, no matter how the rest of your app handles the status-bar.
Change the controlstyle property of your player from the method below: -(void)applyUserSettingsToMoviePlayer
player.controlStyle = MPMovieControlStyleFullScreen causes the above problem,change it to MPMovieControlStyleEmbedded and see if that works.
- Analog clock with UIImages for hands?
- Integrate iAd pre-roll video integration in my app?
- Can you give UIStackView borders?
- How do I play an m4a file in swift 2 upon the touch of a button?
- UIAppearance not taking effect on UILabels created programmatically
- How can I reconnect to device after disconnecting in Core Bluetooth
- cameranode rotate as iOS device moving
- Change iOS app's language on the fly
- integer constant does 'not reduce to an integer'
- Getting QMake to generate a proper .app
- accessoryButtonTappedForRowWithIndexPath: not getting called.
- iOS NSUserDefaults access before synchronize completion
- How to show UIWebView's scroll indicators
- UITableView load more when scrolling to bottom like Facebook application
- Changing the Color of the Status Bar