I made the custom player by using AVAudioPlayer. Now, I want to fetch the details of the audio file such as artist name,album name,etc which is added in the resource folder.
MPMusicPlayer provides the API for fetching the details but its using iPod library and its not taking the resource from sandbox of application. So, MPMusicPlayer is not going to work in that scenario.
So, how can we fetch the details of audio file in iPhone.
I see that the tag-reading code Wayne posts is being copy-pasted too much. If you use
kAudioFilePropertyInfoDictionary
, you don't need id3DataSize, don't need to read raw ID3Tag data and id3TagSizeLength id3TagSize are not used also. Just open the file and read the tag:Dicionary keys are defined in AudioFile.h, starting with kAFInfoDictionary.
However, there is another tag-reading key, which will return different results (with other keys):
You can get this information through the
AudioToolbox.framework
. TheAudioToolbox.framework
is a C API, so I wrote an Objective-C wrapper for it:ID3Tag .h:
ID3TagParser.h
ID3TagParser.m