【问题标题】:HTML5 player video won't stream when deployed部署时 HTML5 播放器视频不会流式传输
【发布时间】:2013-06-28 16:00:20
【问题描述】:

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

【问题讨论】:

    标签: c# html asp.net-mvc-4


    【解决方案1】:

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

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

    【讨论】:

    • 感谢您的快速回复。我会努力研究的。 ty
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-23
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    相关资源
    最近更新 更多