我正在录制视频并将其保存到文档文件夹中,我想稍后使用视频路径再次播放,但它没有播放我正在使用以下代码获取文档文件夹中文件的路径,然后播放它
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] init] autorelease];
[dateFormat setDateFormat:@"dd-MM-yyyy||HH:mm:SS"];
NSDate *now = [[[NSDate alloc] init] autorelease];
NSDate* theDate = [dateFormat stringFromDate:now];
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"Default Album"];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil];
NSString *videopath= [[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@/%@.mov",documentsDirectory,theDate]] autorelease];
NSLog(@"Vide Path %@",videopath);
NSString *path = [[NSBundle mainBundle] pathForResource:videopath ofType:@"mov" inDirectory:nil];
NSURL *movieURL = [NSURL fileURLWithPath:path];
player= [[ MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[self presentMoviePlayerViewControllerAnimated:player];
你能帮帮我吗谢谢。