tags:

views:

212

answers:

1

I have captured video in iPhone 3GS using the UiImagePickerController, but the same app does not engage the Video camera on iPhone 4,it is also working fine on iPhone 3GS (OS 4).

Following is the code i used to engage the video camera.

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.mediaTypes =  [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];   
[imagePicker release];
A: 

You need to specify your UIImagePickerControllerCameraDevice to either UIImagePickerControllerCameraDeviceRear or UIImagePickerControllerCameraDeviceFront on the iPhone 4

Also, set

UIImagePickerControllerCameraCaptureMode to UIImagePickerControllerCameraCaptureModeVideo

iPhone UIImageController Reference

Thanks nd6 I'll give it a try.
TechThirsty
How should i detect which is the current OS version on the device.
TechThirsty
Ok this is what i got: NSString *systemVersion=[[UIDevice currentDevice] systemVersion]; if([systemVersion floatValue]>4.0){ imagePicker.cameraDevice=UIImagePickerControllerCameraDeviceRear; imagePicker.cameraCaptureMode=UIImagePickerControllerCameraCaptureModeVideo; imagePicker.videoQuality=UIImagePickerControllerQualityTypeHigh; }
TechThirsty
alternatively, you can check if the device is available using isCameraDeviceAvailable (http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/occ/clm/UIImagePickerController/isCameraDeviceAvailable:)please use this solution for system version:http://stackoverflow.com/questions/820142/how-to-target-a-specific-iphone-version