Alexandre Brisebois
Alexandre Brisebois

Reputation: 6743

How can I playback an audio stream from a Icecast on WP7

How can I playback an audio stream from a Icecast on WP7

I have tried SMF, SmoothStreaming Client and the MediaElement.

None of these have worked. The formats are either asx or and wma.

Edit:

Recently I found a new stream. this stream works when I'm in the designer. But it does not work on the device. On the device the stream is opened and closed immediately.

this stream is from an IceCast server in MP3 format. with a ?.mp3 extention. or without.

Upvotes: 4

Views: 2780

Answers (4)

Alexandre Brisebois
Alexandre Brisebois

Reputation: 6743

When you are streaming live radio, the stream may be encoded by an IceCast server or ShoutCast server. To read these streams, you will need to decode the stream in memomry and pass it to the MediaElement once it has been decoded.

have a look at Mp3MediaStreamSource

and Audio output from Silverlight

I lost tons of time on this, and this is the best solution I found so far.

Upvotes: 1

Chris Rae
Chris Rae

Reputation: 5665

Does your stream work on the device when you unplug it from the computer? Media playing doesn't work while you're plugged into the Zune sync center.

Chris

Upvotes: 0

Rusty
Rusty

Reputation: 11

You're not adding the ?.mp3 to the pls file right, to the embedded URL? IF you are using the URL you get from the PLS/M3U file, you might need to append a file extension to it. You can often do this by adding ?ext=.mp3 or ?file.mp3 to the URL and it should play with MediaElement, as I read on the MS dev boards that people had been getting that to work with Shoutcast streams.

Upvotes: 0

Derek Lakin
Derek Lakin

Reputation: 16319

Having had a quick look at the Icecast web site (I'm not familiar with their service) it seems that most of what they offer for streamed audio is offered in MP3 format, but that they provide this as playlists in either M3U or XSPF format. You can't provide this to any of the built-in controls or classes in the WP7 framework, but you can parse the contents of the file and pass that to a MediaElement to play individual files.

The M3U file is a simple list of the consituent URLs, so is the simplest to deal with, but the XSPF format (which is an XML format) provides more information, such as the title. You can easily use the XDocument class to parse the XSPF file and then use LINQ to query the contents.

Upvotes: 0

Related Questions