【问题标题】:HTML5 video won't play in IE9HTML5 视频无法在 IE9 中播放
【发布时间】:2013-02-22 21:02:36
【问题描述】:

网址:http://carolpolis.com/#media

HTML

<video width="auto" height="200px" poster="images/WithCourage.jpg" controls>
<source src="media/WithCourage.mp4" type="video/mp4">
<source src="media/WithCourage.webm" type="video/webm">
<source src="media/WithCourage.ogv" type="video/ogg">
Your browser does not support the video tag.
</video>

.htaccess

AddType video/ogg .ogv
AddType video/ogg .ogg
AddType video/mp4 .mp4
AddType video/webm .webm
AddType application/x-shockwave-flash swf

文档类型

<!DOCTYPE HTML>

视频在 Firefox 和 Chrome 中完美播放,但在 IE9 中我只看到“海报”图像,没有媒体控件。它似乎知道它们是视频,但是当我右键单击它们并按“播放”时没有任何反应。

非常感谢您的帮助! 梅雷迪思

【问题讨论】:

标签: html video internet-explorer-9


【解决方案1】:

您的 mp4 视频编码不正确。

根据this question 的回答,我将您网站上的一个视频转换为使用基线 (3) 编码配置文件,这使得视频可以在 IE10 的 html 页面上运行。

【讨论】:

  • 我不想使用 PHP 来转换视频,所以我在这里使用了 HTML5 视频转换器dvdvideosoft.com/free-dvd-video-software.htm 并将 .mp4 文件替换为我假设具有正确编码配置文件的新文件与 IE9 一起工作。感谢您为我指明正确的方向。
  • 该问题中的人正在使用 ffmpeg ffmpeg.org,这可能是 dvdvideosoft 在幕后使用的。
【解决方案2】:

尝试使用绝对 URL,例如:

<video width="auto" height="200px" poster="images/WithCourage.jpg" preload controls>
<source src="http://carolpolis.com/media/WithCourage.mp4" type="video/mp4">
<source src="http://carolpolis.com/media/WithCourage.webm" type="video/webm">
<source src="http://carolpolis.com/media/WithCourage.ogv" type="video/ogg">
Your browser does not support the video tag.
</video>

并添加&lt;meta http-equiv="X-UA-Compatible" content="IE=Edge"/&gt;

【讨论】:

  • 试过但没有运气。感谢您的尝试!
  • 添加了对 部分和 preload 属性的更新,但视频似乎仍然无法在 IE9 中播放。音频文件很好,只是视频。再次感谢您的尝试!
【解决方案3】:

在这个问题上浪费了很多时间。我发现返回内容类型错误的问题(使用 fiddler2)。我试图用 web.config 修复它,但没有任何帮助。所以我为视频文件编写了特定的操作,问题就解决了

public ActionResult GetVideoFile(string id = "")
{
    string dir = Server.MapPath("/Content/MyVideoFiles");
    string path = System.IO.Path.Combine(dir, id);
    if ((System.IO.File.Exists(path))) {
        return File(path, "video/mp4");
    }
    return null;
}

【讨论】:

    猜你喜欢
    • 2011-10-20
    • 2014-04-06
    • 2012-08-02
    • 2013-03-17
    • 2012-01-25
    • 2011-10-10
    • 2016-12-17
    • 1970-01-01
    相关资源
    最近更新 更多