【发布时间】:2013-04-26 17:48:35
【问题描述】:
我是新来的。我已经浏览了 2 天的解决方案,但不满意。
这是我的代码:
NSString *docPath = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *docaPathFull = [docPath stringByAppendingPathComponent:@"/IMG_0003.m4v"];
self.videoURL = [NSURL fileURLWithPath:docaPathFull];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
UIImage *thumbnail = [player thumbnailImageAtTime:4.0 timeOption:MPMovieTimeOptionExact];
player = nil;
self.imageView.image = thumbnail;
问题是,我无法使 MPMoviePlayerController 的视频文件可见。我无法获得缩略图,也无法播放,只有黑色播放器和无限加载。
我试过了:
NSString*thePath=[[NSBundle mainBundle] pathForResource:@"IMG_0003" ofType:@"m4v"];
self.videoURLtheurl=[NSURL fileURLWithPath:thePath];
还有这个
self.videoURL = [[NSBundle mainBundle] URLForResource:@"IMG_0005" withExtension:@"mov"];
还有这个
NSString *filePath = @"/Users/[user]/Documents/video/IMG_0004.mov";
self.videoURL = [NSURL fileURLWithPath:filePath];
如果你有任何想法如何拯救我的生命,请做!!!
非常感谢您的宝贵时间。
【问题讨论】:
-
视频的具体路径是什么?它是在文档目录中还是在应用程序包中? 困惑
标签: iphone ios xcode mpmovieplayercontroller thumbnails