views:

2753

answers:

5

Is it possible to play shoutcast (or some) internet radio streams with html5?

So I have next code:

<html>
<body>
<audio src="http://shoutcast.internet-radio.org.uk:10272/" />
</body>
</html>

I save it as HTML page and start my browser (Google chrome 4.0.249.78, safary or FF)

But it does not play/work!(

And it does not play with any other internet radio I tried to play!(

Why!?! What am I doing wrong?

btw: from HTML5 (including next generation additions still in development) 2.6.1 Protocol concepts User agents can implement a variety of transfer protocols, but this specification mostly defines behavior in terms of HTTP. [HTTP]

The HTTP GET method is equivalent to the default retrieval action of the protocol. For example, RETR in FTP. Such actions are idempotent and safe, in HTTP terms.

The HTTP response codes are equivalent to statuses in other protocols that have the same basic meanings. For example, a "file not found" error is equivalent to a 404 code, a server error is equivalent to a 5xx code, and so on.

The HTTP headers are equivalent to fields in other protocols that have the same basic meaning. For example, the HTTP authentication headers are equivalent to the authentication aspects of the FTP protocol.

+1  A: 

Well, Firefox and Opera do not support non-Free codecs such as mp3 (as with the Opera 10.5 alpha, FF 3.5 and later supports only PCM wav and Ogg Vorbis for audio). I believe Chrome and Safari do support MP3, however.

The next problem is that your URL appears to point to a webpage describing the stream, not to a stream.

Finally, as far as I know, no one has implemented a playlist parser for the audio element (the spec only mentions audio files, not playlists), which is a problem here, as even when you click "listen" you get a playlist rather than a raw stream.

Kelly Clowers
word "Web radio" exist here alot (in specification) http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#attr-media-src
Blender
Your right, I was looking in the wrong place.
Kelly Clowers
+4  A: 

HTML5 doesn't specify what audio formats (whether progressive or streaming) the player must support. That's up for the browser to determine, based on demand and implementation feasibility. In earlier drafts, we tried to specify a few baseline codecs and formats that all browsers must support, but each of the possible formats caused some browser vendor to refuse to implement it.

The following appears to work in Safari (4.0.4, WebKit nightly 6531.21.10, r54538, Mac OS X 10.6.2), but not Chrome or Firefox:

<!DOCTYPE html>
<audio controls src="http://shoutcast.internet-radio.org.uk:10272/"&gt;&lt;/audio&gt;

(note that <audio> requires an end tag in the HTML serialization, it can't use an XML style self-closing tag, and I need to include controls or autoplay in order to actually start the audio)

This is likely due to the fact that Safari gets support for Shoutcast "for free" because it just uses QuickTime to handle any audio and video URLs it is given, and QuickTime already has support for Shoutcast. This can also lead to some strange bugs, as QuickTime's HTTP implementation is, well, quirky, to put it kindly.

I'd suggest filing bugs asking for Shoutcast support in browsers that don't support it. Here are the bug trackers for Firefox (Gecko/Mozilla), Chrome (Chromium), and Safari (if it happens not to work on Windows, or something like that).

Brian Campbell
+1  A: 

You cant do it with ShoutCast but with Icecast and edcast client u can stream live vorbis trought html5 audio tag .. just point it to http://your-url.com:port/stream.ogg :p

Yahoo
do you know any live radiostation broadcasting in ogg?
Blender
+1  A: 

Add a semicolon to the end of the http request. It IS the protocol set forth by shoutcast to override it's browser detection. Like this:

<audio controls src="http://shoutcast.internet-radio.org.uk:10272/;"&gt;&lt;/audio&gt;

Nate Sweet
A: 
<audio controls src="http://example.com:8000/mountpath;"&gt;&lt;/audio&gt;
Schattenbaum