我正在尝试找到视频文件路径并将该路径存储到我的sqlite中我从照片库获取视频为此使用类似的代码
-(IBAction)showVideoLibraryPicker
{
picker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
picker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeMovie, nil];
[self presentModalViewController:picker animated:YES];
}
else {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"Error" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
为了拍摄视频我使用此代码
- (IBAction)showVideoPicker {
//picker = [[UIImagePickerController alloc] init];
//
// picker.sourceType = UIImagePickerControllerSourceTypeCamera;
// picker.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
// picker.delegate = self; picker.editing = NO; [self presentModalViewController:picker animated:YES];
//picker = [[[UIImagePickerController alloc] init] autorelease];
picker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie];
[self presentModalViewController:picker animated:YES];
//[picker setCameraOverlayView:cameraOverlay];
// picker.navigationBarHidden = YES;
// picker.toolbarHidden = YES;
}
else {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"Camera is not available" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
// [self presentModalViewController:picker animated:YES];
}
我很困惑如何获得将该视频路径存储到sqlite的路径。
我找到了照片路径但没有获得视频路径。 为了找到照片路径,我使用像这样的代码
NSData *imageData = UIImagePNGRepresentation(self.imageView.image);
NSData *myImage=[[NSData alloc]initWithData:imageData];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(@"%@",documentsDirectory);
NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",camtitle.text]];
[myImage writeToFile:fullPathToFile atomically:YES];
NSLog(@"%@",fullPathToFile);
[myImage release];
我该如何处理视频。我需要帮助才能解决问题 提前致谢