HTML5视频错误 - Internet Explorer 9 [英] HTML5 Video Error - Internet Explorer 9
问题描述
我正在尝试使用html5视频标记在IE9中播放.m4v视频。当我从远程位置播放视频时,它工作正常:
I am trying to get a .m4v video to play in IE9 using html5 video tags. When I play the video from a remote location it works fine:
<video src="http://www.jplayer.org/video/m4v/Big_Buck_Bunny_Trailer_480x270_h264aac.m4v" controls="controls">
</video>
但是当我想从我的服务器上播放时...
But when I want to play it from my server...
<video src="Big_Buck_Bunny_Trailer_480x270_h264aac.m4v" controls="controls">
</video>
...它仅适用于Chrome,而不适用于IE9。
...it only works in Chrome and not in IE9.
当我的服务器上有什么可能导致视频无法播放?
What could cause the video not to play when located on my server?
非常感谢,
Chris
推荐答案
除了需要服务器发送正确的 Content-Type
请求的视频文件本身的标题,你应该考虑使用一个孩子< source>
标签而不是 src
属性,例如:
In addition to needing the server to send the correct Content-Type
header for the requested video file itself, you should consider using a child <source>
tag instead of the src
attribute, eg:
<video controls="controls">
<source src="Big_Buck_Bunny_Trailer_480x270_h264aac.m4v" type='video/x-m4v; codecs="..."'>
</video>
这将允许您预先指定实际的视频类型信息,以便浏览器决定是否甚至可以下载文件。如果需要,还可以让您灵活地在以后提供其他视频类型。
That will allow you to specify up-front the actual video type information so the browser can decide whether to even download the file at all. As well as give you flexibility to offer additional video types later on, if desired.
这篇关于HTML5视频错误 - Internet Explorer 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!