title: MPMoviePlayerController and overlay window
body: <p>Iam trying to play a video from a remote location and trying to overlay a window over the entire screen which is more or less transparent with few images along the edges . As soon as the movie is preloaded I play the video. This happens good the first time. But if I try to replay the video it does not play the video and neither am i able to click on the Play button from the controls of the player. I guess the overlay window is over the controls. How do i get the controls over the overlay window.</p>
  
  <p>//- (void)moviePlayerContentPreloadDidFinish:(NSNotification *)notification{</p>
  
  <pre><code>NSLog(@"content preloaded");
  NSDictionary *userInfo = [notification userInfo];
  if ([userInfo valueForKey:@"error"]) {
      NSLog(@"*** An error occurred preloading the movie");
      return;
  }
  
  [self.spinner stopAnimating];
  
  // Add the overlay view to the movie, so we can catch the clicks
  OverlayViewController *ovc = [[OverlayViewController alloc] initWithNibName:@"OverlayView" bundle:nil];
  self.overlayController = ovc;
  [ovc release];
  [self.overlayController setNextResponder:self];
  
  MPMoviePlayerController *moviePlayer = [notification object];   
  
  
  [moviePlayer play];
  
  // Locate the movie player window
  NSArray *windows = [[UIApplication sharedApplication] windows];
  NSLog(@"window count= %d",[windows count]);
  if ([windows count] &lt; 2) {
      NSLog(@"*** Window for movie player is missing");
      return;
  }
  
  UIWindow *moviePlayerWindow = [windows objectAtIndex:1];
  [moviePlayerWindow addSubview:self.overlayController.view];
  </code></pre>
  
  <p>}</p>
  
  <p>The code that I use is</p>
  
  <p>Am I doing something wrong. Is it possible to get the controls over the overlay or auto play it.</p>