Search code examples
iphoneobjective-cvideo-captureduration

How to store the time period(duration) of a captured video in iPhone?


Thanks to all for responding to the questions which I posted.

I got one problem that is, while capturing the video in the iPhone, I don't know how to store the time period (duration) that I captured video with iPhone. Can any one solve my problem.

I am using the following code for capturing.

-(void) RecordVideoWithCamera
{
    printf("\n Hai  I am in record vedio with camera  -============");
    [self startCameraPickerFromViewController:self usingDelegate:self];
}

- (BOOL)startCameraPickerFromViewController:(UIViewController*)controller usingDelegate:(id<UIImagePickerControllerDelegate>)delegateObject  
{  

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {
        UIImagePickerController *picker = [[[UIImagePickerController alloc] init]autorelease];
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
        picker.delegate = self;
        picker.showsCameraControls=YES; 
        picker.allowsEditing = NO;
        UIView *overlayView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
        picker.cameraOverlayView = overlayView;
        [controller presentModalViewController:picker animated:YES];
    }
    return YES;  
}  

Thanking you, Madan Mohan.


Solution

  • I think you should check CMTime struct.