2013-06-28 86 views
0

以下代碼在本地IIS上正常工作,但部署後的視頻不再流式傳輸(它們會下載並播放)。看起來像是服務器配置或項目配置問題。任何人都可以幫助或給我帶頭?HTML5播放器視頻在部署時不會流式傳輸

try 
      { 
       ScreenDefinition sd = handler.Get(); 
       Response.Clear(); 
       Response.ClearHeaders(); 
       Response.ClearContent(); 
       if (Format == "Ogg") 
       { 
        Response.ContentType = "video/ogg"; 
        Response.AddHeader("Content-Length", sd.Ogg.Length.ToString()); 
        Response.AddHeader("Content-Disposition", "attachment; filename=video.ogg"); 
        Response.OutputStream.Write(sd.Ogg.ToArray(), 0, sd.Ogg.Length); 
       } 
       else { 
        Response.ContentType = "video/mp4"; 
        Response.AddHeader("Content-Length", sd.WhatCanKADoScreenMp4.Length.ToString()); 
        Response.AddHeader("Content-Disposition", "attachment; filename=video.mp4"); 
        Response.OutputStream.Write(sd.Mp4.ToArray(), 0, sd.Mp4.Length); 
       } 
       Response.End(); 
      } 
      catch 
      { 
       //videos streaming was canceled by user 
       //log it 
      } 

代碼在瀏覽:

<video width="400" height="300" controls="controls" autoplay="autoplay" style="margin-left: 270px; margin-bottom: 5px;"> 
     <source src="@Url.Action("GetVideoStream", new { Format = "Mp4" })" type="video/mp4"> 
     <source src="@Url.Action("GetVideoStream", new { Format = "Ogg" })" type="video/ogg"> 
    Your browser does not support the video tag. 
    </video> 

回答

相關問題