Is it possible to play an Icecast stream using HTML5's AUDIO tag? The syntax I'm using seems happy enough with ShoutCast but not Icecast which I'm confused by. Also if I browse to a certain URL of an Icecast stream a browser window automatically displays the player (see last example).
Working ShoutCast example.
<audio src="http://107.182.233.214:8000/;listen.pls?sid=1" autoplay="true" muted="false" controls="true" volume="1.0"></audio>
Non working Icecast examples.
<audio src="http://91.121.59.45:8016/;stream" autoplay="false" muted="false" controls="true" volume="1.0"></audio>
<audio src="http://91.121.59.45:8016/stream" autoplay="false" muted="false" controls="true" volume="1.0"></audio>
<audio src="http://91.121.59.45:8016" autoplay="false" muted="false" controls="true" volume="1.0"></audio>
Icecast stream URL which opens the player automatically in a browser.
http://91.121.59.45:8016/stream
Is it possible to play an Icecast stream using HTML5's AUDIO tag?
Yes, absolutely.
The only requirement is that the browser supports the codec that you're streaming in.
The syntax I'm using seems happy enough with ShoutCast but not Icecast which I'm confused by.
All these stream URLs with semicolons ;
are for SHOUTcast only. SHOUTcast servers run their admin interface on the same URL as streams. They do user agent sniffing to determine whether the client is a web browser or an audio player. When web pages started playing audio many years ago, they needed a way to work around this problem so that browsers could get the audio stream. A stream URL with a semicolon in it forces SHOUTcast to ignore the browser's user agent and replace it with "MPEG OVERRIDE", which causes the rest of the server to return the stream.
Only ;
is needed. The whole ;stream
thing is just unnecessary stuff that was copied and pasted.
You can read more here: https://stackoverflow.com/a/38217135/362536
As for Icecast streams, all you need is this:
<audio src="http://91.121.59.45:8016/stream" />
(Unless of course you support multiple codecs, in which case you would use multiple sources.)