当我使用 UISaveVideoAtPathToSavedPhotosAlbum 将视频保存到“相册”中时,如何以 asset-library://asset/asset.mov .... 格式检索它的新 Assets URL。
//outputURL.path is : file:///private/var/mobile/Applications/4535724C-7ABD-4F00-A363-9A62022F8EB0/tmp/trim.E8CD7632-7C52-4EA4-A462-8C5131B214AA.MOV.exp.mov
UISaveVideoAtPathToSavedPhotosAlbum(outputURL.path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
最佳答案
除了UISaveVideoAtPathToSavedPhotosAlbum
之外,您还可以使用-[ALAssetsLibrary writeVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock (ALAssetsLibraryWriteVideoCompletionBlock)completionBlock]
方法(Apple Documentation here)
例如:
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:videoPathURL
completionBlock:^(NSURL *assetURL, NSError *error)
{
/* process assetURL */
}];
重要说明:处理ALAssetsLibrary时要记住的重要一点是,assetURL仅在ALAssetsLibrary实例的生存期内有效。因此,请确保您拥有对库的引用,直到完成处理assetURL和任何关联的ALAsset为止。
关于ios - UISaveVideoAtPathToSavedPhotos相册输出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22128515/