WP7 Streaming HTTP audio

Tag: windows-phone-7 , audio-streaming , background-agents Author: aikesixita Date: 2012-02-19

Trying to use the BackgroundAudioAgent just like a previous post: How do I stream an MP3 over HTTP in the background?

The answer says to just put the radioreference.relay.com URL in an AudioTrack object.

Here's my code:

        // A playlist made up of AudioTrack items.
    private static List<AudioTrack> _playList = new List<AudioTrack>
    {
        new AudioTrack(new Uri("Ring01.wma", UriKind.Relative), 
                        "Ringtone 1", 
                        "Windows Phone", 
                        "Windows Phone Ringtones", 
                        //new Uri("shared/media/Ring01.jpg", UriKind.Relative)),
                        null),

        // A remote URI
        new AudioTrack(new Uri("http://relay.radioreference.com:80/346246215", UriKind.RelativeOrAbsolute),
                            "Title",
                            "Artist",
                            "Album",
                            null),


        // A remote URI
        new AudioTrack(new Uri("http://traffic.libsyn.com/wpradio/WPRadio_29.mp3", UriKind.Absolute), 
                        "Episode 29", 
                        "Windows Phone Radio", 
                        "Windows Phone Radio Podcast",
                        //new Uri("shared/media/Episode29.jpg", UriKind.Relative))
                        null)
    };

From there it's just the sample code from Microsoft (http://go.microsoft.com/fwlink/?LinkId=226292).

The first and third track from the sample play, but the radioreference.com track doesn't work. I've tried removing the :80, changing the UriKind to Absolute, removing the http, etc. It winds up calling the OnError handler in the sample code and just bails out.

Any other ideas on this?

[Please check this Question and my answer, it may help you.][1] [1]:
That's what I was refering to, but it doesn't work for me. Do you have code that actually works with the URL listed in my code? I know it's valid because I can play it with a MediaElement no problem.
Are you able play same url file with any other streaming player like , WMP or media element ??
Yes. I was able to play directly with MediaElement. See my answer below. I just had to add .mp3 to the end. shrug

Other Answer1

Well, apparently for relay.radioreference.com I actually just had to add the .mp3 extension, even though it's not required by MediaElement.

            new AudioTrack(new Uri("http://relay.radioreference.com/346246215.mp3", UriKind.RelativeOrAbsolute),
                            "Title 3",
                            "Artist",
                            "Album",
                            null),

Duh. Hopefully this helps someone else who's using relay.radioreference.com.