Question

I have quick question. I am using the following code to launch camera and record video on iOS 4.x devices, it works great. I want to use the same code on iPad 2 device as iPad 2 has video recording facility. Will it work? Can someone please guide me?

if ([types containsObject:(id)kUTTypeMovie])
{
    UIImagePickerController *pickerController = [[[UIImagePickerController alloc] init] autorelease];
    pickerController.delegate = self;
    pickerController.videoQuality = appDelegate.settingsCtrler.quality;
    pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    pickerController.showsCameraControls = YES;
    pickerController.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie];
    pickerController.videoMaximumDuration = maxDuration;
    [appDelegate hideFloatingBar];
    [self presentModalViewController:pickerController animated:YES];
}

Thank you in Advance!

Was it helpful?

Solution

If it builds on iOS 4.3 you should be OK - although I don't have an iPad2 to test it on. I would wrap the logic in a test though:

if([picker isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    // Your code here.
}

so that it doesn't try and present a camera when one isn't available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top