[英]how to save video in IOS7?
我使用以下代碼將視頻保存在照片庫中,但是它無法正常運行IOS7。
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:urlVideo])
{
[library writeVideoAtPathToSavedPhotosAlbum:urlVideo completionBlock:^(NSURL *assetURL, NSError *error){
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
[self ShowMessage:@"Failed to create movie ! It may be due to video quality,please try again/" andTitle:@"ERROR:" andButtonTitle:@"Close"];
[self EnableView];
}
else {
[self ShowMessage:@"Movie created successfully" andTitle:@"Movie Status" andButtonTitle:@"Ok"];
[self EnableView];
}
});
}];
}
我也使用了這種方法,但是這種方法也無法在IOS7中保存視頻
UISaveVideoAtPathToSavedPhotosAlbum (exportPath, [GlobalMethods sharedInstance], @selector(video:didFinishSavingWithError:contextInfo:), nil);
請讓我知道是否僅需要在此方法中進行任何修改,或者是否有其他方法可以在IOS7中存儲視頻。 提前致謝。
試試這個...
#pragma mark - ImagePicker Controller Delegate
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *sourcePath = [[info objectForKey:@"UIImagePickerControllerMediaURL"]relativePath];
UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);
}
如果您有任何問題,請告訴我
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.