枚举类型
AVAssetExportPresetLowQuality
AVAssetExportPresetMediumQuality
VAssetExportPresetHighestQuality
输出预设低质量 、导出预置中等质量、导出预置最高质量
/**
?选择视频
?*/
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset {
? ? [SVProgressHUD showWithStatus:@"加载视频中"];
? ? // open this code to send video / 打开这段代码发送视频
? ? [[TZImageManager manager] getVideoOutputPathWithAsset:asset presetName:AVAssetExportPresetHighestQuality success:^(NSString *outputPath) {
? ? ? ? [SVProgressHUD dismiss];
? ? ? ? // Export completed, send video here, send by outputPath or NSData
? ? ? ? // 导出完成,在这里写上传代码,通过路径或者通过NSData上传
? ? ? ? AVURLAsset*asset = [[AVURLAssetalloc]initWithURL:[NSURLfileURLWithPath:outputPath]options:nil];
? ? ? ? NSURL*url = asset.URL;
? ? ? ? Video_url= url;
? ? ? ? //导航跳转
? ? ? ? QXReleaseVC*release = [[QXReleaseVCalloc]init];
? ? ? ? release.type=@"3";//视频
? ? ? ? release.url= url;
? ? ? ? @weakify(self)
? ? ? ? release.block= ^{
? ? ? ? ? ? @strongify(self)
? ? ? ? ? ? [self.tableView.mj_headerbeginRefreshing];
? ? ? ? };
? ? ? ? [self presentViewController:release animated:YES completion:nil];
? ? }failure:^(NSString*errorMessage,NSError*error) {
? ? ? ? NSLog(@"视频导出失败:%@,error:%@",errorMessage, error);
? ? }];
}