我是新来的。我已经 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];
如果你有任何想法如何拯救我的生命,请做!!!
非常感谢您的时间。