How to get HTML5 to play a stream from Shoutcast

瘦欲@ 提交于 2020-06-26 14:16:23

问题


Currently I am using a flash player to play my shoutcast stream. I would like people on mobile devices to be able to listen as well, and it seems HTML5 is the way to go. How would I go about getting this shoutcast stream "stardust.wavestreamer.com:3353" working in HTML5?

I tried using

but that does not seem to be compatible with shoutcast.


回答1:


If you connect to a SHOUTcast server with a web browser, it will detect your browser because it has Mozilla in the User-Agent header, and send you to the admin page for the stream anyway. You can test this yourself by simply going to http://stardust.wavestreamer.com:3353/.

Fortunately, SHOUTcast servers provide a way to force the loading of the stream. Just add a semicolon ; to the end of the URL.

http://stardust.wavestreamer.com:3353/;

Internally in the SHOUTcast server, it will now see your User-Agent string as MPEG OVERRIDE, which no longer contains Mozilla, so you get the actual media stream.



来源:https://stackoverflow.com/questions/16871553/how-to-get-html5-to-play-a-stream-from-shoutcast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!