[英]iPhone : MPMoviePlayerController Dismiss itself before playing video
I am trying to play video(.mp4) in my app using following code. 我正在尝试使用以下代码在我的应用中播放视频(.mp4)。
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. 它显示了用于播放视频的视图,但是在一秒钟之内它用于关闭MPMoviePlayerController视图并返回到我的视图。
What could be wrong ? 有什么问题吗?
尝试替换代码中的以下行
NSURL *url = [NSURL fileURLWithPath:moviePath];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.