访问流缓冲区HttpWebRequest

Tep*_*ian 7 c# streaming httpwebrequest windows-phone-7

我正在尝试在Windows Phone 7应用程序中流式传输,我正在使用它ManagedMediaHelpers.在HttpWebRequest获得源源不断的作品,但不会调用因为连续流的回调URL.

如何在没有回调Url的帮助下访问流?在其他帖子上有人说O需要使用反射,但是有人知道热实现吗?这是我的代码:

req = (HttpWebRequest) WebRequest.Create(
    "http://streamer-dtc-aa01.somafm.com:80/stream/1018");

// if this is false it will fire up the callback Url 
// but the mediastreamsource will throw an exception 
// saying the it needs to be true
req.AllowReadStreamBuffering = true; 

IAsyncResult result = req.BeginGetResponse(RequestComplete,null);

private void RequestComplete(IAsyncResult r)
{
    HttpWebResponse resp = req.EndGetResponse(r) as HttpWebResponse;
    Stream str = resp.GetResponseStream();

    mss = new Mp3MediaStreamSource(str, resp.ContentLength);
    Deployment.Current.Dispatcher.BeginInvoke(() => {
        this.me.Volume = 100;
        this.me.SetSource(mss);
    });
}
Run Code Online (Sandbox Code Playgroud)

Den*_*sky 1

有同样的问题,所以这是我解决的方法:

从 Windows Phone 7 上的连续流获取字节

这也可能是您的 URL 的问题 - 确保如果您在应用程序外部运行请求,您将获得必要的数据量。