2011-05-27 68 views
0

我按下录制按钮的同时打开视频模式。然后我可以捕捉视频。捕获后,视频记录必须停止。现在位于左侧的屏幕显示重拍按钮下方,并使用右侧的按钮。这里是我的问题开始,如果我按下使用按钮,如何将视频不同的名称保存在特定的文件夹中?我怎样才能访问该特定文件夹中的视频?如何从iPhone应用程序捕捉视频?

请给出与示例代码的想法来解决这个问题。

由于提前,

Senthilkumar

回答

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]; 
} 
+0

海迪帕克,感谢给出的主意,但这是行不通的。如果我们处于捕获模式。保存为nsdata格式的图像。我们在这里使用什么?在图像[myfilemanagername writedata:nsdataname];就像我们想要使用视频文件节省时间一样。 – Senthilkumar 2011-05-30 10:18:42

+0

我们在这里谈论图片或视频吗? – 2011-05-30 10:29:57

+0

什么是错误? – 2011-05-30 10:30:32