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:
- UISearchController: show results even when search bar is empty
- iOS InApp Purchase Receipt Validation iOS 7
- How to hide navigation bar back button?
- iOS push notification: how to detect if the user tapped on notification when the app is in background?
- What is the relationship between Storyboard form factor & Active Scheme in Xcode using Autolayout?
- Localization on the fly with localized Storyboards
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.
- If I override a class method, is there a way I can call the original method (the one that was overridden)?
- This hash only works for enumeration types
- ld: warning: section __DATA/__objc_imageinfo__DATA has unexpectedly large size
- Is anyone get Address-Sanitizer (known as asan or -fsanitize=address) work for iOS?
- What are common sources of PhoneGap with jQuery Mobile performance issues?
- Creating ionic resources for iOS doesn't work anymore
- SQLite3 error – iOS
- Add separator between section in TabBar
- How should Git Flow work with QA testing both a release and a new feature?
- iOS – UIButton on UIPageControl not working
- App crashes when not backgrounded and opened using URL Scheme
- iOS Are methods called by delegates and observers executed on the main thread?
- Swift error: Reference to generic type Dictionary requires arguments in <…>
- Swift: handling an unexpected nil value, when variable is not optional
- Ask for Permission for Local Notifications in iOS 8, but still have the App Support iOS 7