korat prashant
korat prashant

Reputation: 1513

how to import video from iphone with no time duration

can 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

Upvotes: 2

Views: 337

Answers (1)

Deepak Danduprolu
Deepak Danduprolu

Reputation: 44633

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

Upvotes: 1

Related Questions