Search code examples
c#windows-phone-7audio-streamingbackground-audio

BackgroundAudioPlayer music streamin not working on some uri`s


I´m currently building a web radio streaming app using the BackgroundAudioPlayer.

The problem is that some uri´s don´t work, others do..

Example of a working url: http://lyd.nrk.no/nrk_radio_p2_mp3_h

Example of a non working uri: http://dab.no:2026

Both of these work on the computer...

Does anyone know what could be wrong?

Here is how i create the AudioTrack:

new AudioTrack(new Uri("http://dab.no:2026", UriKind.Absolute), "1 fm", "Molde", "", null, null, EnabledPlayerControls.Pause)

The onError returns: System.Exception: -1072875802

I will be happy very if someone helps :D

Regards Daniel


Solution

  • I wrote about something similar in this blog post. Basically, I think your issue is that your URL that doesn't work, is using a shoutcast stream, which needs a slightly different HTTP request to get to the stream.

    Try this:

    new AudioTrack(new Uri("http://dab.no:2026/; stream.mp3"), "1 fm", "Molde", "", null, null, EnabledPlayerControls.Pause)