Shocks
Shocks

Reputation: 808

ALAsset "real" filename

I have transfered an MP4 from iTunes to my iPad. If I open the Videos app I can see it listed - there's the thumbnail and the filename below (my_file.mp4). However the actual filename of the asset is changed in iOS to some unique value - IMG_001.MOV, for example. I would like to get the the original filename as it is listed in the Videos app (my_file.mp4). How are where do I find this?

Thanks

Upvotes: 0

Views: 1405

Answers (2)

Hardik Thakkar
Hardik Thakkar

Reputation: 15951

Here is a Code to get the Real name of AssetsFile

ALAssetsGroupEnumerationResultsBlock assetsEnumerationBlock = ^(ALAsset *result, NSUInteger index, BOOL *stop) {

        if (result) {
            [self.arrAssetsMedia addObject:result];
        }

        ALAssetRepresentation *rep = [result defaultRepresentation];

        if (rep.filename!=nil) {
            NSLog(@"File name is::%@",rep.filename);
            [arrMediaFileName addObject:rep.filename];
        }
    };

Note:ALAssetRepresentation has a property - (NSString *)filename with the help of this we can get the file name

Upvotes: 1

Shamsudheen TK
Shamsudheen TK

Reputation: 31311

You Can't get the MP4 file from your device with its original name.

The only way to retrieve the PhotoGallery item (photos/videos) from your device to your application is through ALAssetLibrary.

The items will have names such as assets-library://asset/asset.MP4?id=1000000001&ext=MP4

So you can track the URL and get the MP4 using ALAsset Library.

Upvotes: 0

Related Questions