如何在 Windows Phone 7 中进行广播流 [英] How to do Radio Streaming in Windows Phone 7

查看:32
本文介绍了如何在 Windows Phone 7 中进行广播流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中进行广播流传输.为此,我尝试了以下代码.但是此代码不起作用.谁能告诉我我错过了什么?首先,我在 .xaml 文件中添加了以下参考

I want to do radio streaming in my application.For that i have tried following code.But this code is not working.Can anyone tell me what i am missing? First i have added following reference in .xaml file

xmlns:smooth="clr-namespace:Microsoft.Web.Media.SmoothStreaming;assembly=Microsoft.Web.Media.SmoothStreaming"

然后我添加了以下代码

<smooth:SmoothStreamingMediaElement x:Name="streamer" AutoPlay="True" Source="http://208.53.158.48:8364"/>

但它不是流式传输.如果您在浏览器中复制上面的 URL,则会打开一个页面.在该页面中有一个收听"按钮.通过单击该按钮,将下载一个 .pls 文件,并通过打开它来播放歌曲.那么有人可以建议我如何从上面的链接进行流式传输吗?

but it is not streaming. If you copy above URL in browser then one page will be opened.In that page there is a "Listen" button. By clicking on that button one .pls file will be downloaded and by opening it the song will be played. So can any one suggest me how to do streaming from above link?

推荐答案

使用 WebClient 下载 .pls 文件,然后以字符串形式读取内容.这应该会为您提供一个 URL,您可以将其设置为 MediaElement 控件的 Source 属性.如果 Silverlight 支持该格式,则会播放音频.

Download the .pls file with a WebClient, then read the contents as a string. This should give you a URL that you can set as the Source property of the MediaElement control. If the format is supported by Silverlight, the audio will play.

这篇关于如何在 Windows Phone 7 中进行广播流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆