5

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),
    };
CRABOLO
  • 8,605
  • 39
  • 41
  • 68
code-addict
  • 137
  • 2
  • 12
  • 1
    Can you show some more code? Are you using AudioStreamingAgent? Does other links work? Have you managed to play any file or stream? – Romasz Dec 04 '13 at 09:21
  • @Romasz Yes, i'm using AudioStreamingAgent, the second link("http://live.radiocosmobandung.com.:8001/cosmo") was working. I get the radio station link from inside the pls/m3u and some direct dns from websurfing yesterday. no more codes outside that which related on that besides playing the audio by backgroundAudio. – code-addict Dec 04 '13 at 09:37
  • I've not played with shoutcast streams. But it seems that you will have to use MediaStreamSource and figure out how to work with this stream. There is an 'old' open project http://shoutcastmss.codeplex.com/ - maybe you will find some help there. Unfortunately I don't know if it works with WP8 -> http://shoutcastmss.codeplex.com/workitem/826 .It seems to be not easy thing to do. – Romasz Dec 04 '13 at 10:10
  • thanks, i will try to work it out, and sry for no upvote on the answer. I accidentally remove it and upvote your first one as replacement if it's bother you. – code-addict Dec 05 '13 at 02:46
  • just finished trying with MediaElement and MediaPlayer, they're giving same result. second link worked out while the shoutcast can't. – code-addict Dec 05 '13 at 05:51
  • Don't bother with this upvotes, just as you finisz, add a solution if it worked. I'm glad I was able to help a little :) – Romasz Dec 05 '13 at 08:14

2 Answers2

2

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. (:

  • Actually i'm already finish the project with shoutcast as an exception before, and i already quit from that company since i'm going to get serious semester in my college. I still carry the code but i don't have anything that support the testing anymore. i will just point this as an answer as i see you were capable to say the answer quite confidently ;). – code-addict Jul 02 '14 at 19:19
  • Leandro, after you did tha, in the MainPage what did you use to play in the Main Page? Mediaelement? – Andressa Pinheiro Oct 16 '15 at 19:38
  • THIS IS AWESOME. I FINNALLY GOT IT WORKING. YOU KNOW THIS SOLVES THE PROBLEM OF MANY PEOPLE ON INTERNET. I'VE SEARCHED ABOUT 2 WEEKS. tHANK YOU – Andressa Pinheiro Oct 16 '15 at 20:00
0

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