我正在访问iphone应用程序中的ipod库并显示专辑的标题,歌词和艺术品。我还想展示歌曲的歌词。我在itunes中添加了歌词,并与设备同步。但是我的代码没有显示歌词…
从这里的例子和代码来获得歌词是:-
- (void)handleNowPlayingItemChanged:(id)notification {
// Ask the music player for the current song.
MPMediaItem *currentItem = self.musicPlayer.nowPlayingItem;
// Display the artist, album, and song name for the now-playing media item.
// These are all UILabels.
self.songLabel.text = [currentItem valueForProperty:MPMediaItemPropertyTitle];
self.artistLabel.text = [currentItem valueForProperty:MPMediaItemPropertyAlbumArtist];
self.albumLabel.text = [[currentItem valueForProperty:MPMediaItemPropertyLyrics]retain];
}
请帮助。由于
NSURL* songURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL]
AVAsset* songAsset = [AVURLAsset URLAssetWithURL:songURL options:nil];
NSString* lyrics = [songAsset lyrics];