Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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),
    };
like image 405
code-addict Avatar asked Nov 02 '22 09:11

code-addict


1 Answers

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

like image 65
Leandro Muto Avatar answered Nov 13 '22 03:11

Leandro Muto