Possible Duplicate:
Play YouTube videos with MPMoviePlayerController instead of UIWebView
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.
- (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];
}