Hello guys, I'm generating a MJpeg Stream and trying to stream it to VLC and play it there.
The code:
public void SendMultiPartData(String contentType, Func<byte[]> getData)
{
MemoryStream mem = null;
response.StatusCode = 200;
for ( byte[] buffer = getData(); buffer != null && buffer.Length > 0; buffer = getData())
{
response.ContentType = "multipart/x-mixed-replace; boundary=--testboundary";
ASCIIEncoding ae = new ASCIIEncoding();
byte[] boundary = ae.GetBytes("\r\n--testboundary\r\nContent-Type: " + contentType + "\r\nContent-Length:" + buffer.Length + "\r\n\r\n");
mem = new MemoryStream(boundary);
mem.WriteTo(response.OutputStream);
mem = new MemoryStream(buffer);
mem.WriteTo(response.OutputStream);
response.OutputStream.Flush();
}
mem.Close();
listener.Close();
}
If I try to open the stream with firefox, there's no problem at all, although with VLC it doesn't work (VLC seems to keep reading but never shows the video)
I've been sniffing VLC-to-VLC streaming and they seems to use as HTTP header "application/octet-stream" instead of multipart/x-mixed-replace
Any ideas ?
Tks in advance, Jose