是否可以在 iPhone SDK 中使用 HTTP 实时流读取元数据
使用 HTTP Live Streaming 方法播放直播时,是否可以读取当前元数据(例如标题和艺术家)?这是一个 iPhone 收音机应用程序。
When playing a live stream using the HTTP Live Streaming method, is it possible read the current metadata (eg. Title and Artist)? This is for an iPhone radio app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不确定这个问题对其作者来说是否仍然存在,但可能会对某人有所帮助。经过两天的痛苦研究,发现其实很简单。这是适合我的代码:
然后:
就是这样。我不知道为什么苹果没有在 AVPlayerItem 的文档中提供此示例来访问流的“标题”,这是现实世界流音频的关键功能。在“AV Foundation Framework Reference”中,他们在需要的地方讲述了“timedMetadata”。 Matt 的示例并不适用于所有流(但 AVPlayer 可以)。
Not sure that this question is still actual for its author, but may be it will help someone. After two days of pain I investigated that it's quite simple. Here is the code that works for me:
and then:
That's it. I dont know why Apple didn't provide in the docs for AVPlayerItem this sample for access "title" of the stream which is the key feature for real world streaming audio. In "AV Foundation Framework Reference" they tell about "timedMetadata" nowhere where needed. And Matt's sample does not work with all streams (but AVPlayer does).
在 swift 2.0 获取音乐流媒体元数据信息:
添加此方法:
in swift 2.0 getting metadata info music streaming:
add this method:
快速解决方案。这是一个简单的流媒体音频播放器的示例。您可以在委托 AVPlayerItemMetadataOutputPushDelegate 的方法中读取元数据。
Swift solution. This is a sample of simple streaming audio player. You can read metadata in the method of delegate AVPlayerItemMetadataOutputPushDelegate.
确实如此,但这并不容易。 Matt Gallagher 在他的博客上发表了一篇关于流音频的不错的帖子。引用他关于这个问题的话:
It is, but it's not easy. Matt Gallagher has a nice post on his blog about streaming audio. To quote him on the subject: