Reputation: 19019
Any help? Now can get NSSize, duration and its all.
Upvotes: 2
Views: 6800
Reputation: 111
You can do this almost entirely using Spotlight's metadata.
For example, I do the following in one of my apps
MDItemRef fileMetadata=MDItemCreate(NULL,(CFStringRef)eachPath);
NSDictionary *metadataDictionary = (NSDictionary*)MDItemCopyAttributes (fileMetadata,
(CFArrayRef)[NSArray arrayWithObjects:(id)kMDItemPixelHeight,(id)kMDItemPixelWidth,nil]);
This code essentially asks for the pixel width and height for a movie file (to determine if it's the dimension of an HD movie or not is the reason).
The Spotlight Metadata Attributes Reference lists all the available keys for various file types by category. You can probably get the required data this way without doing anything significant, provided that the media type you're examining has a Spotlight plug-in.
Upvotes: 5
Reputation: 1984
This functionality may not be built in (I'm honestly not sure), but I do know of two third-party libraries which can tell you the information you need.
I can go into more depth with how to use either of these, but I'd rather only do so if you end up needing me to. Let me know!
Upvotes: 4