File Download for progressive streaming

Mar 24, 2011 at 1:45 PM


I've configured progressive video player on my website. When I'm passing direct url to .mp4 file everything works fine.

when I'm trying to pass file bytes from my .ashx file. Player begins to play but if you try to seek it'll write buffering, buffer video till the seekpoint and continue to play.

here is my file download script in .ashx handler


 FileStream sourceFile = new FileStream(FileName, FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] buffer = new byte[(int)FileSize];
sourceFile.Read(buffer, 0, (int)sourceFile.Length);

context.Response.AddHeader("Content-Disposition", "attachment;filename=file.mp4");
context.Response.ContentType = "application/octet-stream";

how can I change the download script to make Progressive Streaming work?