iPhone sdk - accessing current song information through an app

后端 未结 2 1241
难免孤独
难免孤独 2020-12-17 21:49

Is it possible to retrieve the info about the current song being played. I\'m looking to get the artist and title so I can then display this on an app?

相关标签:
2条回答
  • 2020-12-17 22:28

    With the publicaly available iPhone API (for OS <= 2.2.1), it is not possible to gather any information from the iTunes library on the device. It can be done using unofficial methods, however, such methods would result in Apple declining your application.

    With the iPhone OS 3.0 API, you can use something like the following:

    MPMediaItem *nowPlayingMediaItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];
    
    0 讨论(0)
  • 2020-12-17 22:29

    It is not currently possible with iPhone OS 2.0, but (without breaking any NDA) it was publicly disclosed on March 17th that iPhone OS 3.0 will add a new API that'll allow apps to extract metadata from the iPod application... I haven't looked at the API myself, but if you have an ADC account you should have a look at the API. I would'nt be surprised if you could get the currently playing song...

    0 讨论(0)
提交回复
热议问题