can't play shoutcast ip with port with backgroundAudio on Windows Phone 8

1.1k views Asked by At

I'm new in developing Windows Phone app, so sorry if I do some silly mistakes.
I can't play shoutcast on WP 8, I already tried what suggested on someone else thread, but it doesn't help.

Here's part of my code: (though it could play no shoutcast one)

 private static List<AudioTrack> _playList = new List<AudioTrack>
    {
        new AudioTrack(new Uri("http://198.50.156.4:8062/;",UriKind.RelativeOrAbsolute), "Radio Vision", null, null, null, null , EnabledPlayerControls.All),
        new AudioTrack(new Uri("http://live.radiocosmobandung.com.:8001/cosmo", UriKind.RelativeOrAbsolute), "Ardan Cosmo", null, null, null, null , EnabledPlayerControls.All),
    };
2

There are 2 answers

3
Leandro Muto On BEST ANSWER

have you already fixed your problem? I've found the solution in this project

You can't put the Shoutcast link in your playList on AudioPlayer class, so you need to set the playList like this:

private static List<AudioTrack> _playList = new List<AudioTrack>
    {
        new AudioTrack(null, "Radio Name", "Music Name", null, null),
    };

and after you need to go on OnBeginStreaming method in AudioStreamer class and set the method like this:

protected override void OnBeginStreaming(AudioTrack track, AudioStreamer streamer)
    {
        // Set the ShoutcastMediaStreamSource to stream shoutcast radio here
        ShoutcastMediaStreamSource source = new ShoutcastMediaStreamSource(new Uri("http://108.170.51.210:8068/;", UriKind.RelativeOrAbsolute));

        // Set the source
        streamer.SetSource(source);
    }

you'll set the ShoutcastMediaStreamSource to do the stream of a Shoutcast link.

Oh, and one more thing (actually three). You'll need the Silverlight.Media.Phone and SM.Media in References of AudioStreamAgent, and the last one is put

using Silverlight.Media;

on the header of AudioStreamer.cs.

And sorry for my english errors. (:

0
matthijs Hoekstra On

Shoutcast is not supported out of the box, you need to implement reading this kind of streams yourself. Not easy.