1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
protected void Page_Load(object sender, EventArgs e)
{
using (FileStream videoStream = File.Open(@"E:\IMEDIA\Test\TestVideoSite\WebSite\temp\VideoGECCO_v2.avi", FileMode.Open))
{
using (BinaryReader reader = new BinaryReader(videoStream))
{
Response.Clear();
Response.Buffer = false;
Response.BufferOutput = false;
Response.ContentType = "video/avi";
byte[] buffer = new byte[1<<16];
int bytesRead = 0;
while ((bytesRead = videoStream.Read(buffer, 0, buffer.Length)) != 0)
{
Response.OutputStream.Write(buffer, 0, bytesRead);
}
Response.End();
}
}
} |
Partager