按下录制按钮的同时打开视频模式。然后我可以捕捉视频。捕获后,视频记录必须停止。现在在左侧的屏幕显示重录按钮下方和右侧的使用按钮。这是我的问题开始,如果我按下使用按钮,如何将视频不同名称保存在特定文件夹中?我如何从该特定文件夹中访问该视频?
请提供示例代码以解决此问题。
提前致谢,
Senthilkumar
答案 0 :(得分:0)
您必须实现以成为UIImagePickerController
对象的委托并实现imagePickerController:didFinishPickingMediaWithInfo:
,如下所示 -
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// This is the URL where the movie is stored (in the tmp directory)
NSURL *movieURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"movie.mov"]; // You will have to vary this.
NSURL *fileURL = [NSURL URLWithString:filePath];
NSError *error;
if ( [[NSFileManager defaultManager] moveItemAtURL:movieURL toURL:fileURL error:&error] ) {
NSLog(@"Error copying: %@", [error localizedDescription]);
}
[self dismissModalViewControllerAnimated:YES];
}