簡體   English   中英

部署時不會流式傳輸HTML5播放器視頻

[英]HTML5 player video won't stream when deployed

以下代碼在本地IIS上可以正常運行,但是當已部署的視頻不再流式傳輸時(它們將被下載然后播放)。 看起來這是服務器配置或項目配置問題。 誰能幫忙或帶頭給我?

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>

我認為您正在尋找的是在服務器上啟用漸進式下載。 我對您的配置一無所知,但是Google搜索會產生良好的結果。

一些更多信息: http : //flash.flowplayer.org/plugins/streaming/pseudostreaming.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM