How to get videos using ALAssetsLibrary in iOS?

Total Post:149

 1035  View(s)
Rate this:
I was trying to get videos from the photo library because I also want to get images list so I am using ALAssetsLibrary. I have successfully get images from the photo library. But I have getting problem with the video because I am not understanding how can I do this.
Please help me.
  1. Post:214

    Re: How to get videos using ALAssetsLibrary in iOS?

    For getting videos ALAssetsFilter class is very helpful during enumeration on group,
    Here is an example:

    ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
    [library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
            [group setAssetsFilter:[ALAssetsFilter allVideos]];
            [group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop){
                if (asset){
                    NSDictionary *meta = [[asset defaultRepresentation] metadata];
    } failureBlock:^(NSError *error) {
        NSLog(@"Enumerating problem with AssetLibrary groups %@", error);

    We can also filter allPhotos, allAssets instead of allVideos.