我利用AVPlayer
在iPod资料库中复制音乐曲目。
完成了后台管理,现在我可以看到我的应用程序图标在点击两次主页按钮时显示在停靠栏中。媒体按钮也适用于我的应用程序。
我现在想做的是在同一停靠栏中显示现在正在播放的项目信息,就像iPodMusicPlayer所做的那样。
可能吗?
使用 MediaPlayer 框架:
#include <MediaPlayer/MediaPlayer.h>
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:@{
MPMediaItemPropertyAlbumArtist:@"Album Artist",
MPMediaItemPropertyAlbumTitle:@"Album Title",
MPMediaItemPropertyTitle:@"Title",
MPMediaItemPropertyArtist:@"Artist"
}];
你不能使用iOS公共API来做到这一点。就iPod音乐应用程序而言,它是Apple内置的本机iOS应用程序,并且肯定使用Private API。
这是苹果的示例代码,可能会有所帮助http://developer.apple.com/library/ios/#samplecode/AddMusic/Introduction/Intro.html