I have added music files in application's document folder and I am playing that music from AVAudioPlayer. How can I get Its title , album name and artist name.
I used MPmediaPlayer to access ipod library . but now I want to make my custom player. Is there any need to use mpmediaplayer in this type of app.I already get the albumtitle and artwork image of ipod songs
I am trying to get it like
NSError *activationError = nil;
[[AVAudioSession sharedInstance] setActive: YES error: &activationError];
// Instantiates the AVAudioPlayer object, initializing it with the sound AVAudioPlaye开发者_运维技巧r *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: soundFileURL error: nil]; self.appSoundPlayer
= newPlayer;
musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
MPMediaItem *item = musicPlayer.nowPlayingItem ;
nowPlayingLabel.text = [item valueForProperty:MPMediaItemPropertyTitle];
NSLog(@"title %@",[item valueForProperty:MPMediaItemPropertyTitle]); [newPlayer release]; // "Preparing to play" attaches to the audio hardware and ensures that playback // starts quickly when the user taps Play [appSoundPlayer prepareToPlay]; [appSoundPlayer setVolume: 1.0]; [appSoundPlayer setDelegate: self];
[appSoundPlayer currentTime];
title is returning (null)
Please help..
精彩评论