Note that there are some explanatory texts on larger screens.

plurals
  1. POProperly displaying and dismissing fullscreen MPMoviePlayerController in iOS 3.2 (iPad)
    primarykey
    data
    text
    <p>I'm having lots of trouble displaying a fullscreen movie in my iPad app and then allowing the user to dismiss it with either the Done button or the "un-fullscreen" button on the player controls.</p> <p>Initially I was using <code>MPMoviePlayerViewController</code> for the movie presentation, but I wasn't receiving the enter/exit fullscreen notifications from its <code>MPMoviePlayerController</code> object, so I switched to doing it myself.</p> <p>I can make the movie appear fullscreen (although the transition is janky), but when either the "Done" or "un-fullscreen" buttons are pressed, no action is taken by the player. I've posted my code below:</p> <pre><code>- (void)startPlayingMovieWithURLString:(NSString *)movieURLString { // I get all of these callbacks **EXCEPT** the "willExitFullScreen:" callback. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterFullScreen:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willExitFullScreen:) name:MPMoviePlayerWillExitFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlayback:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil]; [self.moviePlayerController setContentURL:someExistingURL]; // "self" is a UIViewController subclass, and is presented as a "fullscreen" modal view controller from its parent // I'm setting the movie player's view's frame to take up the full rectangle of my view controller, but really I want the movie to be completely removed when the user presses "done" (that is, removed from the view hierarchy). Not sure when/where to do this. self.moviePlayerController.view.frame = self.view.frame; [self.view addSubview:self.moviePlayerController.view]; [self.moviePlayerController setFullscreen:YES animated:YES]; } </code></pre> <p>And here is the code for my didFinish callback</p> <pre><code>- (void)didFinishPlayback:(NSNotification *)notification { // This ends up recursively telling the player that playback ended, thus calling this method, thus…well you get the picture. // What I'm trying to do here is just make the player go away and show my old UI again. [self.moviePlayerController setFullscreen:NO animated:YES]; } </code></pre> <p>So obviously I am doing something wrong but I've been up and down the documentation and I can't figure out how to make the movie just go away. I figured it would be more intuitive than this. What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload