我正在使用以下代码捕获视频:
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
ipc.delegate = self;
//need to handle delegates methods
//
ipc.allowsEditing = YES;
ipc.videoQuality = UIImagePickerControllerQualityTypeMedium;
ipc.videoMaximumDuration = 30.0f; // 30 seconds
//temporary duation of 30 seconds for testing
ipc.mediaTypes = [NSArray arrayWithObject:@"public.movie"];
// ipc.mediaTypes = [NSArray arrayWithObjects:@"public.movie", @"public.image", nil];
[self presentModalViewController:ipc animated:YES];
//this controller allows to record the videos
我可以使用以下代码将录制的视频保存到相册中:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// recover video URL
NSURL *url = [info objectForKey:UIImagePickerControllerMediaURL];
// check if video is compatible with album
BOOL compatible = UIVideoAtPathIsCompatibleWithSavedPhotosAlbum([url path]);
// save
if (compatible){
UISaveVideoAtPathToSavedPhotosAlbum([url path], self, @selector(video:didFinishSavingWithError:contextInfo:), NULL);
NSLog(@"saved!!!! %@",[url path]);
}
[self dismissModalViewControllerAnimated:YES];
[picker release];
}
但我需要从相册中检索该文件并将其存储到文档目录中吗?