0

我怎样才能录制视频

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

我试过这个,但我正在捕捉图像,但我没有捕捉到视频。

4

2 回答 2

2
#import <MobileCoreServices/UTCoreTypes.h>


-(void)actionStartVideoRecord:(id)sender  {
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
    return;
}
UIImagePickerController* imagePicker = [[[UIImagePickerController alloc] init] autorelease];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.videoQuality = UIImagePickerControllerQualityTypeHigh;
imagePicker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
imagePicker.delegate = self;

[self presentModalViewController:imagePicker animated:YES];
}






- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mType = [info valueForKey:UIImagePickerControllerMediaType];
if([mType isEqualToString:@"public.movie"]){
[NSData dataWithContentsOfURL:[info objectForKey:@"UIImagePickerControllerMediaURL"]]
}
}
于 2012-06-04T07:17:36.453 回答
0

出现imagePickerController后,启动设备的 videoCapture。

有关更多信息,请参阅UIImagePickerController的文档

你可以创建一个子类UIImagePickerController。在那里你可以有一个UIButton. 点击它,您可以开始捕捉视频。

于 2012-06-04T06:53:46.570 回答