title: MPMoviePlayer video from youtube
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1779511/play-youtube-videos-with-mpmovieplayercontroller-instead-of-uiwebview">Play YouTube videos with MPMoviePlayerController instead of UIWebView</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to play video from a youtube url and once mpmovieplayer is launched, it is been closed instantly. How to play video from youtube url? note that I am using iOS5. Thanks.</p>
  
  <pre><code>- (IBAction)video1 {
  
          //NSBundle *bundle = [NSBundle mainBundle];
          //NSString *moviePath =[bundle pathForResource:@"" ofType:@"mp4"];
          NSURL *movieURL = [NSURL fileURLWithPath:@"http://www.youtube.com/testVideo"];
          MPMoviePlayerController *daMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
          daMovie.scalingMode = MPMovieScalingModeAspectFill;
          [daMovie play];
          MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
          [self presentMoviePlayerViewControllerAnimated:moviePlayer];
  
      }
  </code></pre>