Html HTML5 视频在 IE 11 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21124885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML5 Video not working in IE 11
提问by user2916637
I have a video archive that I have working in everything except IE 11. I get the error "Error: Unsupported video type or invalid file path" when loaded in IE 11. Below is the HTML I am using.
我有一个视频存档,我在 IE 11 之外的所有版本中都可以使用。在 IE 11 中加载时出现错误“错误:不支持的视频类型或无效的文件路径”。下面是我正在使用的 HTML。
<video id="movie" width="640" height="400" autobuffer controls preload="auto">
<source src="/media/Archive_Videos/September%202013/September_13_U-RUN.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="/media/Archive_Videos/September%202013/September_13_U-RUN.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="/media/Archive_Videos/September%202013/September_13_U-RUN.ogv" type='video/ogg; codecs="theora, vorbis"' />
<object type="application/x-shockwave-flash" data="http://player.longtailvideo.com/player.swf" width="640" height="360">
<param name="movie" value="http://player.longtailvideo.com/player.swf" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="flashVars" value="controlbar=over&file=SITE%2Fmedia%2FArchive_Videos%2FSeptember%25202013%2FSeptember_13_U-RUN.mp4" />
<span title="No video playback capabilities, please download the video below">September 2013 U-RUN</span>
</object>
<p>OOPS! It looks like your browser doesn't support HTML5 videos. You can either install the latest version of your browser or download the video below:
<br /><a href="SITE.com/media/Archive_Videos/September%202013/September_13_U-RUN.mp4">MP4 format</a> | <a href="SITE.com/media/Archive_Videos/September%202013/September_13_U-RUN.ogv">Ogg format</a> | <a href="SITE.com/media/Archive_Videos/September%202013/September_13_U-RUN.webm">WebM format</a></p>
</video>
I also have an .htaccess file so it works in Firefox.
我还有一个 .htaccess 文件,所以它可以在 Firefox 中使用。
AddType audio/ogg oga ogg
AddType video/ogg ogv
Why isn't it working in IE 11?
为什么它在 IE 11 中不起作用?
回答by st0ne
What is the resolution of the video? I had a similar problem with IE11 in Win7. The Microsoft H.264 decoder supports only 1920x1088 pixels in Windows 7. See my story: http://lars.st0ne.at/blog/html5+video+in+IE11+-+size+does+matter
视频的分辨率是多少?我在 Win7 中的 IE11 也有类似的问题。Microsoft H.264 解码器在 Windows 7 中仅支持 1920x1088 像素。请参阅我的故事:http: //lars.st0ne.at/blog/html5+video+in+IE11+-+size+does+matter
回答by Ilan Biala
I believe IE requires the H.264 or MPEG-4 codec, which it seems like you don't specify/include. You can always check for browser support by using HTML5Pleaseand Can I use.... Both sites usually have very up-to-date information about support, polyfills, and advice on how to take advantage of new technology.
我相信 IE 需要 H.264 或 MPEG-4 编解码器,您似乎没有指定/包含。您可以随时使用HTML5Please和Can I use...来检查浏览器支持。这两个站点通常都有关于支持、polyfills 和如何利用新技术的建议的最新信息。
回答by Simon Ingeson
I've been having similar issues of a video not playing in IE11 on Windows 8.1. What I didn't realize was that I was running an N version of Windows, meaning no media features were installed. After installing the Media Feature Pack for N and KN versions of Windows 8.1and rebooting my PC it was working fine.
我在 Windows 8.1 上的 IE11 中遇到了视频无法播放的类似问题。我没有意识到我运行的是 N 版本的 Windows,这意味着没有安装媒体功能。在为 Windows 8.1 的 N 和 KN 版本安装媒体功能包并重新启动我的电脑后,它工作正常。
As a side-note, the video worked fine in Chrome, Firefox, etc, since those browsers properly fell back to the webm
file.
作为旁注,该视频在 Chrome、Firefox 等中运行良好,因为这些浏览器正确地回退到该webm
文件。
回答by Gawet
I know this is old, but here is a additional thing if you still encounter problems with the solution above.
我知道这已经过时了,但是如果您仍然遇到上述解决方案的问题,这里还有另外一件事。
Just put in your <head>
:
只需输入您的<head>
:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
It will prevent IE to jump back to IE9 compatibility, thus breaking the video function. Worked for me, so if you still have problems, consider checking this out.
它会阻止 IE 跳回 IE9 兼容,从而破坏视频功能。为我工作,所以如果你仍然有问题,请考虑检查一下。
Alternatively you can add this in PHP :
或者,您可以在 PHP 中添加:
header('x-ua-compatible: ie=edge');
Or in a .htaccess file:
或者在 .htaccess 文件中:
header set X-UA-Compatible "IE=Edge"
回答by johnson tsang
It was due to IE Document-mode version too low. Press 'F12' and using higher version( My case, above version 9 is OK)
这是由于 IE 文档模式版本太低。按'F12'并使用更高版本(我的情况,版本9以上是可以的)
回答by vicky shrestha
In my case Codec ID of mp4 file was the issue, Codec ID: isom (isom/iso2/avc1/mp41) was not playing in IE 10 and 11 using video tag, after I converted it to "mp42 (mp42/isom/avc1)" using FFmpeg it started playing in IE as well.
在我的情况下,mp4 文件的编解码器 ID 是问题,编解码器 ID:isom (isom/iso2/avc1/mp41) 没有在 IE 10 和 11 中使用视频标签播放,在我将其转换为“mp42 (mp42/isom/avc1 )" 使用 FFmpeg 它也开始在 IE 中播放。
回答by codeDr
I used MP4Boxto decode the atom tags in the mp4. (MP4Box -v myfile.mp4) I also used ffmpeg to convert the mp41 to mp42. After comparing the differences and experimenting, I found that IE11 did not like that my original mp4 had two avC1 atoms inside stsd.
我使用MP4Box来解码 mp4 中的原子标签。(MP4Box -v myfile.mp4) 我还使用 ffmpeg 将 mp41 转换为 mp42。经过比较差异和实验,我发现IE11不喜欢我原来的mp4在stsd中有两个avC1原子。
After deleting the duplicate avC1 in my original mp41 mp4, IE11 would play the mp4.
在我原来的 mp41 mp4 中删除重复的 avC1 后,IE11 会播放 mp4。
回答by Vonwelzen
Although MP4 is supported in Internet explorer it does matter how you encode the file. Make sure you use BASELINE encoding when rendering the video file. This Fixed my issue with IE11
尽管 Internet Explorer 支持 MP4,但您如何对文件进行编码并不重要。确保在渲染视频文件时使用 BASELINE 编码。这解决了我的 IE11 问题