jwplayer不能在线播放问题(已解决)
用下面的代码,不能播放。
protected void play3()
{
string fileName = "aaa.f4v";
string fullFilePath = Server.MapPath("VTS_02_1.f4v");//路径
byte[] buffer;
using (FileStream fileStream = new FileStream(fullFilePath, FileMode.Open))
{
int fileSize = (int)fileStream.Length;
buffer = new byte[fileSize];
fileStream.Read(buffer, 0, (int)fileSize);
}
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.BufferOutput = true;
Response.ContentType = "video/mp4";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.CacheControl = "public";
// writes buffer to OutputStream
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.Flush();
Response.End();
}
ysyc1
11 years, 6 months ago