更改锁屏背景音频控制文本?
我有一个使用 AVAudioSession 流式传输背景音频的 iOS 应用程序。它工作正常,但我很好奇,有什么方法可以更改锁定屏幕音频控件上的文本吗?现在它只显示我的应用程序的名称,但我想将其更改为曲目的名称。
此外,多任务栏的控件下没有文本 - 有没有办法像 iPod 应用程序那样在那里添加曲目名称?
I have an iOS app that streams background audio using AVAudioSession. It is working correctly, but I am curious, is there any way to change the text on the lock screen audio controls? Right now it simply displays the name of my app, but I would like to change it to the name of the track.
Additionally, the multi-tasking bar has no text under the controls- is there a way to add the track name there, as the iPod app does?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
iOS 5 现在支持在锁定屏幕和远程播放控件(双击主页按钮并向右滑动时获得的控件)中设置曲目标题以及专辑封面图像。看看
MPNowPlayingInfoCenter
类。当然,为了最大限度地提高兼容性,您需要通过执行以下操作来测试MPNowPlayingInfoCenter
是否可用:iOS 5 now supports setting the track title as well as an album art image in both the lock screen and the remote playback controls (the controls you get when you double-click the home button and swipe right). Take a look at the
MPNowPlayingInfoCenter
class. Of course, to maximize compatibility, you'd want to test whetherMPNowPlayingInfoCenter
is available, by doing something like:这是快速的! (不再需要检查 iOS 5 及更高版本)
here it is in swift! (no need to check for iOS 5 and up anymore)