cod*_*ict 5 c# shoutcast windows-phone-8
我是开发Windows Phone应用程序的新手,很抱歉如果我犯了一些愚蠢的错误.
我不能在WP 8上播放shoutcast,我已经尝试过在别人的帖子上提出的建议,但它没有帮助.
这是我的代码的一部分:(虽然它可以不播放一个shoutcast)
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),
};
Run Code Online (Sandbox Code Playgroud)
你已经解决你的问题了吗?我在这个项目中找到了解决方案
您不能将 Shoutcast 链接放在 AudioPlayer 类的播放列表中,因此您需要像这样设置播放列表:
private static List<AudioTrack> _playList = new List<AudioTrack>
{
new AudioTrack(null, "Radio Name", "Music Name", null, null),
};
Run Code Online (Sandbox Code Playgroud)
然后您需要继续 AudioStreamer 类中的 OnBeginStreaming 方法并设置如下方法:
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);
}
Run Code Online (Sandbox Code Playgroud)
您将设置 ShoutcastMediaStreamSource 来执行 Shoutcast 链接的流。
哦,还有一件事(实际上是三件事)。AudioStreamAgent的References中需要Silverlight.Media.Phone和SM.Media,最后一项放在
using Silverlight.Media;
Run Code Online (Sandbox Code Playgroud)
在 AudioStreamer.cs 的标题上。
并对我的英语错误表示歉意。(: