Reputation: 69
I've been trying to find a way to play a live ShoutCast stream using C#. I've been researching the internet for that, and so far i have only found some ways for playing streams with fixed length, but i want to play a live radio station.
Does anyone know how to do that?
Upvotes: 1
Views: 1634
Reputation: 163301
SHOUTcast streams are basically HTTP streams, but with a broken status line header. Instead of HTTP/1.1 200 OK
, you get ICY 200 OK
. From there, you can detect the format and codec from the Content-Type
response header (such as audio/mpeg
) and stream playback as the data comes in.
In addition to this, there is metadata interleaved into the stream. This is optional but can be requested by adding the following header to your request:
Icy-MetaData: 1
Then in the response headers, you will see Icy-MetaInt
to tell you how many bytes are between each metadata chunk. See this post for more info on how to handle that metadata: https://stackoverflow.com/a/4914538/362536
Upvotes: 1