I am trying to play video(.mp4) in my app using following code.
NSString *doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *moviePath = [doc stringByAppendingPathComponent:@"output.mp4"];
NSLog(@"Movie Path : %@",moviePath);
NSURL *url = [NSURL URLWithString:moviePath];
NSLog(@"URL : %@",url);
MPMoviePlayerViewController* controller = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:controller];
//[controller release];
It shows view for playing video but within a second it use to dismiss the MPMoviePlayerController view and comes back into my view.
What could be wrong ?
Try to replace below line in your code