我記錄視頻後出現問題,點擊使用按鈕將此視頻保存到庫中,但保存完成後,我無法點擊播放按鈕或重拍按鈕。這是我的代碼:單擊UIImagepickercontroller中的使用按鈕後無法點擊ios
-(void)actionLaunchAppCamera
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
imagePickerController.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.showsCameraControls = YES;
imagePickerController.allowsEditing = YES;
imagePickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
imagePickerController.delegate = self;
imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
[self presentModalViewController:imagePickerController animated:YES];
//[imagePickerController release];
}
}
}
保存所採取
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
NSURL *recordedVideoURL= [info objectForKey:UIImagePickerControllerMediaURL];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:recordedVideoURL]) {
[library writeVideoAtPathToSavedPhotosAlbum:recordedVideoURL
completionBlock:^(NSURL *assetURL, NSError *error){
[library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
NSDate* date = [asset valueForProperty:ALAssetPropertyDate];
NSLog(@"Date Time Modify %@",date);
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat: @"dd.MM.yyyy HH:mm:ss"];
NSString* CurrentDateStamp = [formatter stringFromDate:date];
NSLog(@"NameVideo %@",asset.defaultRepresentation.filename);
NSLog(@"DateModify %@",CurrentDateStamp);
NSLog(@"Size: %lld", asset.defaultRepresentation.size);
} failureBlock:nil];
actionSheetUpload= [[UIActionSheet alloc] initWithTitle:@"Do you want to upload this video?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Upload" otherButtonTitles:nil];
actionSheetUpload.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheetUpload showInView:[UIApplication sharedApplication].keyWindow];
[actionSheetUpload release];
}
];
}
[library release];
}
任何想法的形象呢?在此先感謝
又在哪裏是玩的代碼..?您只是保存視頻,之後需要播放視頻 –
保存視頻後,我會將此視頻上傳到服務器。我更新了我的問題中的代碼。 – user3214941
然後你應該使用播放器來播放它。 –