Last active
November 25, 2016 17:09
-
-
Save jayeshk/1a66a71ca8576b132b521502bf2c78b6 to your computer and use it in GitHub Desktop.
Save resource video file to photo library using asset library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL* videoURL = [[NSBundle mainBundle] URLForResource:@"demo-clip" withExtension:@"mp4"];; | |
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; | |
ALAssetsLibraryWriteVideoCompletionBlock completionBlock = | |
^(NSURL *savedURL, NSError *error) { | |
if (error) { | |
NSLog( @"Error while saving video Photo Library: %@", error ); | |
} else { | |
NSLog( @"Successfuly saved video to Photo Library %@", savedURL.absoluteString); | |
} | |
}; | |
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:videoURL]) | |
{ | |
[library writeVideoAtPathToSavedPhotosAlbum:videoURL completionBlock:completionBlock]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment