开发者

how to import video from iphone with no time duration

can开发者_JAVA技巧 any one help me please i just want to pick video from iphone which already recorded with help of uiimagepicker controller. i want to copy my apps document directory. ---------------------------------- prashant


I am unsure of what you mean with no time duration. But you can do the copying/moving in the UIImagePickerDelegate method.

- (void) imagePickerController:(UIImagePickerController *)picker 
 didFinishPickingMediaWithInfo:(NSDictionary *)info {

    NSURL *movieURL = (NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];

    NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    NSURL *saveURL = [NSURL fileURLWithPath:[documentsDirectory stringByAppendingPathComponent:@"movie.mov"]];

    NSError *error;
    if (!([[NSFileManager defaultManager] moveItemAtURL:movieURL toURL:saveURL error:&error])) {
        NSLog(@"Error saving: %@", [error localizedDescription]);
    }

    [picker dismissModalViewControllerAnimated:YES];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜