HTML5播放器视频赢得';t在部署时进行流式传输

本文关键字:部署 传输 视频 播放器 HTML5 | 更新日期: 2023-09-27 18:20:10

以下代码在本地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>

HTML5播放器视频赢得';t在部署时进行流式传输

我认为您想要做的是在服务器上启用Progressive下载。我对你的配置一无所知,但谷歌搜索会产生好结果。

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