This project is read-only.

Streaming an mp3

Apr 2, 2010 at 4:17 AM

Hey great job on this server, really nice!

I am using the WebServerSample. It works great for showing an html page in the files dir. I tried adding an mp3 in there, but it wont serve that up at the moment. Any ideas on what it would take to serve up mp3 files? I ultimatly want to open the mp3 via WMP Open URL. I figure there is going to be a custom module in there to serve up the file, but I was also thinking that it might be a content type thing as well.

Any help would be great...

 

Thanks again for this really cool stuff.

-Savij

Apr 2, 2010 at 7:30 AM

You need to add a file association for .mp3. Version 1.1 as a limited set of files that it handles per default.

Use fileModule.MimeTypes.Add

In version 2.0 you can send a stream (in your case a FileStream) back by returning StreamResult from a controller method.

 

class FileController : Controller
{
  public IActionResult Get()
  {
     return new StreamResult(new FileStream(Parameters["filename"]));
  }
}