2011-05-27 39 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