I'm trying to stream radio in a Windows Phone 7 app and for this I'm using ManagedMediaHelpers
. The HttpWebRequest
to get the continuous stream works but doesn't call the callback Url because of the continuous stream.
How do I access the stream without the help of the callback Url? On other posts some said O need to use reflection but does someone knows hot to implement it? Here is my code:
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);
});
}
Had the same issue, so here is how I solved it:
Getting bytes from continuous streams on Windows Phone 7
It might also be a problem with your URL - make sure that if you run the request outside the application, you are getting the necessary amount of data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With