iPhone sdk - 通过应用程序访问当前歌曲信息

时间:2022-12-16 10:41:55

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 个解决方案

#1


10  

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.

使用公共可用的iPhone API(对于OS <= 2.2.1),无法从设备上的iTunes库收集任何信息。它可以使用非官方方法完成,但是,这样的方法会导致Apple拒绝您的应用程序。

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

使用iPhone OS 3.0 API,您可以使用以下内容:

MPMediaItem *nowPlayingMediaItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];

#2


2  

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...

它目前不适用于iPhone OS 2.0,但是(没有破坏任何NDA)它在3月17日公开披露,iPhone OS 3.0将添加一个新的API,允许应用程序从iPod应用程序中提取元数据......我的避风港我自己看过API,但是如果你有一个ADC帐户,你应该看一下API。如果你能得到目前正在播放的歌曲,我不会感到惊讶......

#1


10  

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.

使用公共可用的iPhone API(对于OS <= 2.2.1),无法从设备上的iTunes库收集任何信息。它可以使用非官方方法完成,但是,这样的方法会导致Apple拒绝您的应用程序。

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

使用iPhone OS 3.0 API,您可以使用以下内容:

MPMediaItem *nowPlayingMediaItem = [[MPMusicPlayerController iPodMusicPlayer] nowPlayingItem];

#2


2  

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...

它目前不适用于iPhone OS 2.0,但是(没有破坏任何NDA)它在3月17日公开披露,iPhone OS 3.0将添加一个新的API,允许应用程序从iPod应用程序中提取元数据......我的避风港我自己看过API,但是如果你有一个ADC帐户,你应该看一下API。如果你能得到目前正在播放的歌曲,我不会感到惊讶......