2

I am trying to create a radio app, which contains a collection of MP3-stream urls. However, I have run into some trouble streaming (or playing back) the audio.

I am trying to connect to a raw data stream like the ones you plug into VLC. An example url is http://mp3.ht-stream.net/;80 (just plugged this one and a few others into VLC and it worked perfectly). Basically your standard internet radio feed.

I have created the AudioPlaybackAgent, filled in what I think is needed to get this up and running, and everything works fine when I stream regular .mp3 files over the internet. But when I try to connect to these streams, it doesn't do (or play) anything.

I reckon it could be because I'm not using an AudioStreamingAgent (with a MediaStreamSource implementation), but that stuff is a bit too advanced for me, and as I understood after some hours searching the interwebs, mp3 streams could use the AudioPlaybackAgent instead.

Any advice on how I can make this work? Will I have to use an AudioStreamingAgent instead? Is there any open source examples as to how I implement this mysterious MediaStreamSource class? Should I scrap my great idea? Any answers will be greatly appreciated.

My AudioPlayer.cs code is available here if you'd like a peek - but it's mostly the standard stuff.

Kris Selbekk
  • 7,438
  • 7
  • 46
  • 73

2 Answers2

2

Look at the Background Audio Streamer sample.

Den
  • 16,686
  • 4
  • 47
  • 87
  • Unfortunately, this is a bit too vague for me. Do I really need to use the `AudioStreamingAgent`, or can I get by with an `AudioPlayBackAgent`? I'm putting a bounty out on this, so feel free to update your answer for some cheap reputation. – Kris Selbekk Aug 09 '12 at 19:56
2

You can't easily play audio from the provided link because of this is not a regular audio file. This is SHOUTcast stream.

You can check some open source implementations and to figure out how to work with this audio stream. For example: Shoutcast MediaStreamSource.

So I can say that you need to implement a lot of stuff in your app to play this stream. There is no quick and easy way.

Alex
  • 887
  • 1
  • 11
  • 29
  • So there are no standard implementation open-sourced as you know of? – Kris Selbekk Aug 10 '12 at 16:16
  • What do you mean by a standard implementation? Standard way is to use your own implementation of [MediaStreamSource](http://msdn.microsoft.com/en-us/library/hh180779(v=vs.95).aspx). Or you can use existing implementation if it's license permits. – Alex Aug 10 '12 at 17:17
  • I mean, there has to be somebody that has done this before me. As far as you are aware, is there such an implementation (or discussion thereof) available publicly? also, how can I tell if a stream is of type SHOUTcast or not? – Kris Selbekk Aug 11 '12 at 05:55
  • I already gave a link above to one of open-source projects. There is other: [ShoutStreamSource](http://shoutstreamsource.codeplex.com/). There is also [a few questions on Stackoverlow](http://stackoverflow.com/search?q=%5Bwindows-phone-7%5D+shoutcast). – Alex Aug 11 '12 at 14:12
  • WP7 don't knows how to work with the shoutcast streams out of the box. So you need to implement MediaStreamSource where you can describe how to work with that type of stream. Or you can use ready open source implemntations from the links above. Or you can use your favorite search engine and find out more. There is a lot information about how to work with shoutcast streams and Windows Phone 7. – Alex Aug 11 '12 at 14:27