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

你说的曾经没有我的故事 提交于 2019-12-04 07:19:05

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!