2

我正在 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];    


}

请帮忙。谢谢

4

1 回答 1

1
NSURL* songURL = [mediaItem valueForProperty:MPMediaItemPropertyAssetURL] 
AVAsset* songAsset = [AVURLAsset URLAssetWithURL:songURL options:nil]; 
NSString* lyrics = [songAsset lyrics];
于 2012-08-04T07:50:52.343 回答