Reputation: 1013
I am working on application in which I am getting an asset urls of the videos and images which are stored in library. I want to know dynamically the url contains image or video ..
It is possible with ALAsset object having the property DefaultAssetRepresentation which returns the MetaData of asset object,which contains image or video fetched from the library.
but i already had asset urls and I am not suppose to use ALAsset.
So anybody know how to check whether asset url contains image or video ? I searched at many places but didn't get anything.Please help me sort out this issue.
Thanks in advance !!
Upvotes: 3
Views: 4534
Reputation: 5977
i think best way is
if ([[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]) {
// asset is a video
}
Asset Types
Constants that specify the type of an asset.
NSString *const ALAssetTypePhoto;
NSString *const ALAssetTypeVideo;
NSString *const ALAssetTypeUnknown;
Upvotes: 30