最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I play a PLS file from a website? - Stack Overflow

programmeradmin6浏览0评论

I would like to play a PLS file (: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 remend?

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!

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 remend?

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!

Share Improve this question edited Dec 11, 2011 at 1:31 Yi Jiang 50.2k16 gold badges139 silver badges136 bronze badges asked Dec 11, 2011 at 0:00 Stefan FilipStefan Filip 1,8014 gold badges16 silver badges26 bronze badges 3
  • jwPlayer doesn't work with .PLS files. I just made a pretty thorough search, and it doesn't seem like any web players do. You would probably have to look up the stream format and write your own media player, which seems rather infeasible to me. – Allen Z. Commented Dec 11, 2011 at 0:29
  • I think this may be a duplicate of stackoverflow./questions/2743279/… – Dagg Nabbit Commented Dec 11, 2011 at 2:05
  • be aware of the limits of HTML5 audio tags: html5doctor./native-audio-in-the-browser and caniuse./#search=audio – Eonasdan Commented Jul 10, 2012 at 19:19
Add a ment  | 

1 Answer 1

Reset to default 3

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:

[playlist]
NumberOfEntries=1
File1=http://live.radioguerrilla.ro:8002/

You could then use the url of File1 (or FileN, if more than 1) as your audio source.

<audio source="http://live.radioguerrilla.ro:8002/"> </audio>
...

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.

发布评论

评论列表(0)

  1. 暂无评论