获取当前播放的歌曲

时间:2012-03-25 10:27:06

标签: iphone objective-c

  

可能重复:
  On iPhone: Find out what song is currently playing? (in the iPod music player)

是否可以在iPhone的音乐播放器中获取当前正在播放的歌曲? 它可以从其他应用程序访问吗? 感谢

1 个答案:

答案 0 :(得分:0)

是的,您可以使用MPMusicPlayerController课程。

+ (MPMusicPlayerController *)iPodMusicPlayer
Return Value

The iPod music player.
nowPlayingItem

The currently-playing media item, or the media item, within a queue, that you have designated to begin playback with.
@property (nonatomic, copy) MPMediaItem *nowPlayingItem
MPMediaItem *currentPlayingSong = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];