问题
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