iPhone 从 Icecast 流媒体广播中提取歌曲名
我正在寻找从 Ice Cast 流媒体广播中提取歌曲名称。我得到了冰冷的流派、冰冷的名字等等。但不是歌名。我们可以从流中提取它吗?
I am looking to extract the Song name from an ice cast streaming radio. I am getting the icy-genre,icy-name n stuff. but not the song name. Can we extract it from the stream?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的问题,我认为您已经将 Icy-Metadata: 1 添加到您的请求中。
您必须阅读“icy-metaint”响应标头,它将告诉您在流中的每个元数据更新之间要读取的字节数。
以下是伪代码:
元数据将如下所示:
不幸的是,对于完整元数据缓冲区的编码或 StreamTitle 的内容,没有绝对的标准。
歌曲名称可能包含也可能不包含专辑名称、艺术家姓名和完整的歌曲名称或其他字段。
元数据缓冲区本身可能是也可能不是 UTF-8。由流客户端决定注入什么。大多数体面的客户端在被迫发送非 ASCII 数据时会使用 UTF-8,但不是全部(它们可能会发送一些本机编码,如 Windows-1521 或 UTF-16)。
如果您想继续获取元数据更新,您可以简单地使用“byteinterval”长度的字节块来获取更多元数据更新,或者稍后断开连接并轮询流。
From your question I presume you already added Icy-Metadata: 1 to you request.
You'll have to read the "icy-metaint" response header, that will tell you how bytes to read between each metadata update in the stream.
The following is pseudocode:
The metadata will look something like this:
Unfortunately there's no absolute standard for either encoding of the complete metadata buffer, or the contents of the StreamTitle.
Song name may or may not contain album name, artist name and complete song name or other fields.
The metadata buffer itself may or may not be UTF-8. It's up to the streaming client to decide on what to inject. Most decent clients will use UTF-8 when forced to send non ASCII data, but not all (and they may send some native encoding like Windows-1521 or UTF-16).
If you want to keep getting metadata updates you can simply consume blocks of "byteinterval" length of bytes to get more metadata updates, or disconnect and poll the stream later.