Silverlight and mp3 streaming

Over the weekend I was taking a look into whether Silverlight might be a better bet than the Flash player for delivering streaming audio (Shoutcast in particular) to end-users. I built an extremely simple application that points a MediaElement at a Shoutcast stream (using the same url tweaking trick oulined in this previous post) and plays it back. Once again, looking through the documentation, it becomes apparent that Microsoft are trying to steer developers towards the use of their own streaming server solution.

So bearing this in mind, is Silverlight a viable browser solution for delivering legacy streams that fall out of the bracket of their own “streaming solution”? It can play back Shoutcast streams across domains in just the same way that Flash can but suffers the same fundamental problem suffered by Flash. There is no means of informing the player that an mp3 stream delivered over http is not intended for download, so the player keeps the whole stream in memory with the expectation that the download will end at some point… with Shoutcast it never does and the player consumes memory (ultimately ALL of the memory, if left playing long enough). So, both Flash AND Silverlight end up in the same basket on this front, slowly consuming all system memory. I think that this is stupidly limiting, and an API extension to drop played data would be a pretty simple enhancement. At the cost of promoting and protecting their own server products, both Adobe and Microsoft are missing a very fat slice of consumer ears.

6 Responses to “Silverlight and mp3 streaming”

  1. Post: 140 - Mirrored Blogs Says:

    [...] and MP3 Streaminghttp://www.flexiblefactory.co.uk/flexible/?p=53Silverlight & Firefox 2 - Getting it to [...]

  2. Nick Says:

    Hi there,

    I’m keen in knowing how you achieved this as I can’t seem to replicate a working solution. I have a shoutcast stream at lets say

    http://nl.ah.fm:9000/

    if I set this to the source of the Media element I just get a network error, for example,

    Me.MyMedia.Source = New Uri(”mms://nl.ah.fm:9000/;”, UriKind.Absolute)

    The above using the trick as you mentioned still produces said error. Any chance you could offer some advice?

    Many thanks for your time.

  3. Nick Says:

    I should mention that I have tried

    Me.MyMedia.Source = New Uri(”http://nl.ah.fm:9000/;”, UriKind.Absolute)

    also…

  4. chris Says:

    I’ll dig out the code I used and post it soon.

  5. chris Says:

    Ok, so I’ve established that you have to use the mms:// scheme, so as follows:

    media.Source = new Uri(”mms://shoutcast2.tidyhosts.com:9058/;”);

    but the really important thing to realise is that this will not work locally. Run it in a web server, or on the web, and it should function correctly.

    i prefer my stream to your stream ;-)

  6. mc Says:

    thanks, i was looking long and hard on how to connect to an icecast server! there seems to be some confusion about whether or not Silver Light can stream MP3. Apparently it can! The confusion came

    Look at this confused dick from MS:

    http://silverlight.net/forums/t/13765.aspx

Leave a Reply