How to do Radio Streaming in Windows Phone 7

你说的曾经没有我的故事 提交于 2019-12-22 01:16:17

问题


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"

and then i have added following code

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

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?


回答1:


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.




回答2:


You don't need to use SmoothStreamingMediaElement, just MediaElement if this is not a Smooth Stream (btw, I don't think there exist audio-only smooth streams, unless you use a 1x1 or other very small image for the video part)

If this is Shoutcast or compatible, see https://shoutcastmss.codeplex.com/

Project Description Shoutcast MediaStreamSource is a MediaStreamSource implementation of the Shoutcast protocol for Silverlight. This MediaStreamSource allows both Silverlight 4+ OOB and Windows Phone 7 applications to consume a Shoutcast stream using a MediaElement.

Currently, Mp3 and AAC+ Shoutcast streams are supported on Windows Phone. However, ONLY Mp3 is supported on Desktop Silverlight.

There is also limited (i.e. somewhat untested) M3u and PLS playlist support.

Please report any issues playing Shoutcast streams with the following: * URI to the problem stream * Description of the problem * The error returned (or not!) from the Shoutcast MediaStreamSource



来源:https://stackoverflow.com/questions/8212860/how-to-do-radio-streaming-in-windows-phone-7

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