如何从网站播放 PLS 文件?
我想播放 PLS 文件 (http://live.radioguerrilla.ro:8002/listen.pls )来自网站。我想使用 HTML5 引入的 audio
标签,但我认为它不能从 PLS 文件中传输。您会推荐什么替代方案?
您是否还可以提供示例代码,因为我尝试使用 jwPlayer 播放该文件,但无法启动。谢谢!
I would like to play a PLS file (http://live.radioguerrilla.ro:8002/listen.pls) from a website. I would like to use the audio
tag introduced by HTML5 but I don't think it can stream from PLS files. What alternative would your recommend?
Could you also provide a sample code as I tried to play the file with jwPlayer but I wasn't able to get it going. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PLS 文件本身只是元数据。您可以编写(或查找)解析器来获取真实的音频源。
上面包含的 PLS url 的内容包含:
然后,您可以使用 File1(或 FileN,如果超过 1)的 url 作为音频源。
编辑:
我刚刚读到 HTML5 应该 支持流媒体,但在对 Firefox 和 Chrome 进行快速研究后,两者都没有明确支持 Shoutcast 协议。 Shoutcast 协议是一个基于 http 的元协议。与将源用作文件(mp3、ogg、wav)的示例不同,可以通过请求确定内容类型。使用shoutcast,响应负载需要由其他东西处理。任何shoutcast流的内容类型结果都将返回文本/纯文本,并且两者都会抛出一条消息说明这一点。
PLS files, themselves, are just metadata. You can write (or find) a parser to get at the real audio source.
The contents of the PLS url you included above contains:
You could then use the url of File1 (or FileN, if more than 1) as your audio source.
EDIT:
I was just reading that HTML5 should support streaming, but after a quick research into firefox and chrome, neither explicitly supports shoutcast protocol. Shoutcast protocol is a meta-protocol on top of http. Unlike examples of using with sources as files (mp3, ogg, wav), one can determine the content-type thru the request. With shoutcast, the response payload needs to be processed by something else. The content-type result of any shoutcast stream will return text/plain, and both will throw a message saying so.