【发布时间】:2013-05-09 13:32:17
【问题描述】:
我创建了一个在文件夹中显示文件的应用程序。 我有一个文件 .mov 格式,我想从文件夹中显示它,但是当运行应用程序并单击播放按钮时,不显示这部电影,我看到了这张图片 :
这是我的代码:(请指导我并告诉我我的错误)
- (IBAction)Play:(id)sender
{
NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES)objectAtIndex:0];
NSString *file = [documentPath stringByAppendingPathComponent:@"xcode4-outlet.mov"];
NSURL *url = [NSURL fileURLWithPath:file];
_moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
[self.view addSubview:_moviePlayer.view];
_moviePlayer.fullscreen = YES;
_moviePlayer.shouldAutoplay = YES;
_moviePlayer.allowsAirPlay = YES;
[_moviePlayer play];
}
编译器也帮我按摩:
movie player[9489:c07] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
movie player[9489:c07] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
movie player[9489:c07] [MPAVController] Autoplay: Enabling autoplay
movie player[9489:c07] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
movie player[9489:c07] [MPAVController] Autoplay: Enabling autoplay
【问题讨论】:
-
NSString *movPath = [[NSBundle mainBundle] pathForResource:@"xcode4-outlet" ofType:@"mov"];或检查电影退出与否[[NSFileManager defaultManager] fileExistsAtPath:file] -
我的朋友我想从文件夹中显示这部电影!!!
标签: ios objective-c mpavcontroller