G
Guest
Hi,
I have a web app and a I have a http handler for a file, when I have a web
request for that file I insert a stream of bytes like this:
public void ProcessRequest(System.Web.HttpContext context)
{
string path = "c:/media/atb.mpg";
byte[] buffer=null;
context.Response.ClearHeaders();
try
{
using(Stream stream = File.Open(path,FileMode.Open))
{
buffer = new byte[1024];
while(stream.Position < stream.Length)
{
//Thread.Sleep(100);
Debug.WriteLine("Read");
stream.Read(buffer,0,buffer.Length);
context.Response.OutputStream.Write(buffer,0,buffer.Length);
//context.Response.Flush();
//Thread.Sleep(1000);
}
//stream.Read(buffer,0,buffer.Length);
}
}
catch{}
}
}
The problem is that the Media player is waiting for the hole file, if I put
this line of code then
context.Response.Flush();
the MP is not working anymore.
I want to publisn on my web server a video stream, is there anyway to do
this ?
Best regards,
Stefan
I have a web app and a I have a http handler for a file, when I have a web
request for that file I insert a stream of bytes like this:
public void ProcessRequest(System.Web.HttpContext context)
{
string path = "c:/media/atb.mpg";
byte[] buffer=null;
context.Response.ClearHeaders();
try
{
using(Stream stream = File.Open(path,FileMode.Open))
{
buffer = new byte[1024];
while(stream.Position < stream.Length)
{
//Thread.Sleep(100);
Debug.WriteLine("Read");
stream.Read(buffer,0,buffer.Length);
context.Response.OutputStream.Write(buffer,0,buffer.Length);
//context.Response.Flush();
//Thread.Sleep(1000);
}
//stream.Read(buffer,0,buffer.Length);
}
}
catch{}
}
}
The problem is that the Media player is waiting for the hole file, if I put
this line of code then
context.Response.Flush();
the MP is not working anymore.
I want to publisn on my web server a video stream, is there anyway to do
this ?
Best regards,
Stefan