tags:

views:

204

answers:

2

HI,

I need to record video using iPhone. To do that i used UIImagePickerController. I have an iPhone 3G, with me. when i run my code to check if source type available it says device not supported. My OS is 3.2.1, where i am wrong, can some one tell me what i need to change.

Also is there some other way to record video. What i need to do is to get the video stream as it is recorded.

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

NSArray *sourceTypes = 
[UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
if (![sourceTypes containsObject:(NSString *)kUTTypeVideo ]){
    NSLog(@"device not supported");
    return;
}

//picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;    
picker.mediaTypes =  [NSArray arrayWithObject:(NSString *)kUTTypeVideo];    
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;


[self presentModalViewController:picker animated:YES];

Thanks,

+1  A: 

That is because the 3G isn't supported for video recording.

Lance
Please flag this as the correct answer: this place is give and take.
Lance
@Lance, there are apps like iCamcorder which records video on iPhone 3G, and I know they did something, so this isnt correct answer.
Akash Kava
hmmm - if indeed they are able to utilise the same frameworks for video recording - see the WWDC2010 vids free on iTunes to developers for video recording - an active working example is available.
Lance
+1  A: 

Lance is correct. The native UIImagePickerController does not work on iPhone 3G. If an app does do video recording on a 3G they are doing a hack like taking multiple photos in succession and manually encoding a video file using the individual images.

CDeutsch