Question

When I save a video in Photos Album by using UISaveVideoAtPathToSavedPhotosAlbum, how can I retrieve it's new asset URL in assets-library://asset/asset.mov.... format

//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);

No correct solution

OTHER TIPS

Instead of UISaveVideoAtPathToSavedPhotosAlbum, you can use the -[ALAssetsLibrary writeVideoAtPathToSavedPhotosAlbum:(NSURL *)videoPathURL completionBlock (ALAssetsLibraryWriteVideoCompletionBlock)completionBlock] method (Apple Documentation here)

For example:

ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
[library writeVideoAtPathToSavedPhotosAlbum:videoPathURL
                           completionBlock:^(NSURL *assetURL, NSError *error) 
{ 
    /* process assetURL */ 
}];

Important Note: The important thing to remember when dealing with ALAssetsLibrary is that the assetURL is only valid for the lifetime of the ALAssetsLibrary instance. So ensure you hold a reference to library until after you have finished processing the assetURL and any associated ALAsset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top