【发布时间】:2011-11-08 17:09:53
【问题描述】:
在使用 AVAudioSession 时,如何将锁屏播放控件中的标签设置为我当前正在播放的音频剪辑的标题?基本上,我希望标签看起来与显示歌曲名称的 iPod 应用程序的锁定屏幕播放控件相同。目前,我的应用在我要更改的标签中显示应用名称。
【问题讨论】:
标签: ios
在使用 AVAudioSession 时,如何将锁屏播放控件中的标签设置为我当前正在播放的音频剪辑的标题?基本上,我希望标签看起来与显示歌曲名称的 iPod 应用程序的锁定屏幕播放控件相同。目前,我的应用在我要更改的标签中显示应用名称。
【问题讨论】:
标签: ios
在 iOS 5 中您可以使用以下代码:
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"Some artist", MPMediaItemPropertyArtist,
@"Some title", MPMediaItemPropertyTitle,
@"Some Album", MPMediaItemPropertyAlbumTitle,
nil];
center.nowPlayingInfo = songInfo;
}
【讨论】: