title: MPMoviePlayerController doesn't work with remoteControlReceivedWithEvent
body: <p>I want to allow the controls from my keyboard to work in my app. The controls use Apple's Remote Control events (<code>beginReceivingRemoteControlEvents</code>, <code>endReceivingRemoteControlEvents</code>, and <code>remoteControlReceivedWithEvent</code>); however I cannot seem to get this to work with <code>MPMoviePlayerController</code>.</p>
  
  <p>I do not see any events at the start of the program, even though <code>beginReceivingRemoteControlEvents</code> is called at the start.
  I do not see any events during the playback of a video.
  I do see events after I close the video.</p>
  
  <p>From the above, it seems that the audio stream of <code>MPMoviePlayerController</code> disables the controls. However I do not know how to change this. I tried using <code>[moviePlayer setUseApplicationAudioSession:NO];</code> to change the audio to use the system session, yet it does nothing.</p>
  
  <p>Here is my setup. My app delegate is a <code>UIViewController</code>. I set the main window's root view controller to the app delegate, add views to the view controller and in the view controller for the parts which has to do with video.</p>
  
  <pre><code>- (BOOL)canBecomeFirstResponder {
      return YES;
  }
  - (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)theIndexPath {
      NSString *file = [[MGMFilesPath stringByExpandingTildeInPath] stringByAppendingPathComponent:[files objectAtIndex:[theIndexPath indexAtPosition:1]]];
      AVAudioSession *audioSession = [AVAudioSession sharedInstance];
      [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
      [audioSession setActive:YES error:nil];
      NSLog(@"%d", [self isFirstResponder]);
  
      moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:file]];
  
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(exitedFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer];
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
  
      if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
          [[self view] addSubview:[moviePlayer view]];
          [moviePlayer setFullscreen:YES animated:YES];
          [moviePlayer play];
      } else {
          [moviePlayer play];
      }
      [fileView deselectRowAtIndexPath:theIndexPath animated:NO];
  }
  
  - (void)viewDidAppear:(BOOL)animated {
      [super viewDidAppear:animated];
      [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
      [self becomeFirstResponder];
  }
  
  - (void)viewWillDisappear:(BOOL)animated {
      [super viewWillDisappear:animated];
      [[UIApplication sharedApplication] endReceivingRemoteControlEvents];
      [self resignFirstResponder];
  }
  
  - (void)remoteControlReceivedWithEvent:(UIEvent *)event {
      NSLog(@"remoteControlReceivedWithEvent: %@", event);
      if (event.type==UIEventTypeRemoteControl) {
          if (event.subtype==UIEventSubtypeRemoteControlPlay) {
              NSLog(@"Play");
          } else if (event.subtype==UIEventSubtypeRemoteControlPause) {
              NSLog(@"Pause");
          } else if (event.subtype==UIEventSubtypeRemoteControlTogglePlayPause) {
              NSLog(@"Play Pause");
          }
      }
  }
  
  - (void)exitedFullscreen:(NSNotification*)notification {
      [[moviePlayer view] removeFromSuperview];
      [moviePlayer stop];
      [moviePlayer release];
      moviePlayer = nil;
      [[AVAudioSession sharedInstance] setActive:NO error:nil];
  }
  
  - (void)playbackFinished:(NSNotification*)theNotification {
      [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:moviePlayer];
      [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
      NSNumber *reason = [[theNotification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
      if ([reason intValue]!=MPMovieFinishReasonUserExited) {
          [moviePlayer setFullscreen:NO animated:YES];
          [[moviePlayer view] removeFromSuperview];
          [moviePlayer stop];
          [moviePlayer release];
          moviePlayer = nil;
          [[AVAudioSession sharedInstance] setActive:NO error:nil];
      }
      NSLog(@"%d", [self isFirstResponder]);
  }
  </code></pre>
  
  <p>As you can see in the code above, I verified that it was first responder and it was, so I know it's not a first responder issue.</p>
  
  <p>Can someone help me get this working?</p>
  
  <p>Thanks</p>