1
DotNet / Streaming music from web
« on: June 17, 2014, 09:53:44 pm »
Are there any examples for streaming music from the web? I've been trying to just pass an HttpResponseStream into the standard Music class, but I end up with a NotSupportedException saying the stream doesn't support seek operations. I'm using a normal ogg file (http://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg).
Am I supposed to do it in some other way, or is it just not supported?
Thanks
Here's my code:
Am I supposed to do it in some other way, or is it just not supported?
Thanks
Here's my code:
static void Main(string[] args) {
RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML_App", Styles.Titlebar);
HttpWebRequest request;
request = (HttpWebRequest)WebRequest.Create("http://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg");
Stream stream = request.GetResponse().GetResponseStream();
SFML.Audio.Music music = new SFML.Audio.Music(stream);
music.Play();
while (window.IsOpen()) {
window.DispatchEvents();
}
}
RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML_App", Styles.Titlebar);
HttpWebRequest request;
request = (HttpWebRequest)WebRequest.Create("http://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg");
Stream stream = request.GetResponse().GetResponseStream();
SFML.Audio.Music music = new SFML.Audio.Music(stream);
music.Play();
while (window.IsOpen()) {
window.DispatchEvents();
}
}