How I can access m4a file from my iPhone. Right now i am only accessing mp3 file and using MpMediaQuery
, but now I want to access m4a file also. I am using this code:
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
NSArray *itemsFromGenericQuery = [everything items];
for (MPMediaItem *songMedia in itemsFromGenericQuery)
{
NSString *songTitle = [songMedia valueForProperty: MPMediaItemPropertyTitle];
NSString *songTitle2 = [[songMedia valueForProperty: MPMediaItemPropertyAssetURL] absoluteString];
NSString *artistName = [songMedia valueForProperty: MPMediaItemPropertyArtist];
//NSString *duration = [songMedia valueForProperty: MPMediaItemPropertyPlaybackDuration];
NSNumber *seconds=[songMedia valueForProperty: MPMediaItemPropertyPlaybackDuration];
int time=[seconds intValue]*1000;
NSString *duration=[NSString stringWithFormat:@"%d",time];
}
Can you please tell me how to do it, how to access m4a file from iPhone music library into my code?