可能重复:
访问前置摄像头。iPhone/iPod 4
如何在 iPhone 中从设备的前置摄像头录制视频。
要使用前置摄像头,我们使用这个:
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
但是如何从中创建视频呢?
可能重复:
访问前置摄像头。iPhone/iPod 4
如何在 iPhone 中从设备的前置摄像头录制视频。
要使用前置摄像头,我们使用这个:
picker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
但是如何从中创建视频呢?
您可以在 iphone 中从前置摄像头录制视频,例如:-
-(IBAction)cameraLibraryButtonClick:(id)sender{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *videoRecorder = [[UIImagePickerController alloc]init];
videoRecorder.delegate = self;
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:videoRecorder.sourceType];
NSLog(@"Available types for source as camera = %@", sourceTypes);
if (![sourceTypes containsObject:(NSString*)kUTTypeMovie] ) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Device Not Supported for video Recording." delegate:self
cancelButtonTitle:@"Yes"
otherButtonTitles:@"No",nil];
[alert show];
[alert release];
return;
}
videoRecorder.cameraDevice=UIImagePickerControllerCameraDeviceFront;
videoRecorder.sourceType = UIImagePickerControllerSourceTypeCamera;
videoRecorder.mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
videoRecorder.videoQuality = UIImagePickerControllerQualityTypeLow;
videoRecorder.videoMaximumDuration = 120;
self.imagePicker = videoRecorder;
[videoRecorder release];
[self presentModalViewController:self.imagePicker animated:YES];
newMedia = YES;
}
else {
[self displaysorceError];
}
}