Search code examples
objective-cios7ios6alassetslibraryalasset

Save Video into Custom Album iOS


How to save video with my custom album . I found one link but it don't work Custom file manager

It gives the url value is null.

[VideoAlbumManager addVideoWithAssetURL:outputFileUrl toAlbumWithName:@"Video Maker"];//outputfileurl is my video url from document directory

Give any suggestion for this..


Solution

  • You can use this link to save the video.. GitHub Link

    Import this two files into your project.

    1. ALAssetsLibrary+CustomPhotoAlbum.h
    2. ALAssetsLibrary+CustomPhotoAlbum.m

    Then in your save IBAction method write this lines..

    if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(outputFilePath)){
    
        NSURL *muyrl=[NSURL fileURLWithPath:outputFilePath];
        [library saveVideo:muyrl toAlbum:albumName withCompletionBlock:^(NSError *error)
        {
            if (error!=nil) {
                NSLog(@"Big error: %@", [error description]);
            } 
        }];
    

    Where.. outputfilepath is your videopath and if you have url then save it with URL name. library is ALAssetLibrary that define in .h file albumName is your Album name what do you want..I hope this will help you.