How to save video from document directory to gallery?

user2402997 picture user2402997 · Jul 22, 2013 · Viewed 7.7k times · Source

How to save video in document directory to gallery in iOS,here i downloaded video from server and saved in document directory and now i want to move it to gallery.

Answer

Manish Agrawal picture Manish Agrawal · Jul 22, 2013
UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);

you can pass the sourcePath as

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

append your path or file name to get sourcePath.

NSString *sourcePath = [documentsDirectory stringByAppendingPathComponent:@"youVideo.mp4"];