Html 不支持指定的“video/mp4”的“type”属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14536298/
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
Specified "type" attribute of "video/mp4" is not supported
提问by markyeoj
I am using mediaelement js.. on my .htacces I have these..
我正在使用 mediaelement js.. 在我的 .htacces 我有这些..
AddType video/mp4 mp4 m4v
AddType audio/mp4 m4a
AddType video/ogg ogv
AddType audio/ogg ogg oga
AddType video/webm webm
and on my index.html I have this on my <head>
在我的 index.html 上我有这个 <head>
<script src="/js/jquery.js"></script>
<script src="/js/mediaelement-and-player.min.js"></script>
<link rel="stylesheet" href="/js/mediaelementplayer.css" />
and the code is
代码是
<video width="600" height="450" preload="none" autoplay preload="auto" >
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
<source type="video/mp4" src="videos/Sequence1.mp4"/>
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
<source type="video/webm" src="videos/Sequence1.webm" />
<!-- Ogg/Vorbis for older Firefox and Opera versions -->
<source type="video/ogg" src="videos/Sequence1.ogv" />
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
<object width="320" height="240" type="application/x-shockwave-flash" data="flashmediaelement.swf">
<param name="movie" value="flashmediaelement.swf" />
<param name="flashvars" value="controls=&file=videos/Sequence1.mp4" />
</object>
</video>
unfortunately.. its not playing on mozilla browser.. it keeps on loading but not playing.. and using the ctrl+shift+k on mozilla.. I found these error.
不幸的是..它不在mozilla浏览器上播放..它继续加载但不播放..并在mozilla上使用ctrl+shift+k..我发现了这些错误。
-- [18:47:12.942] Specified "type" attribute of "video/mp4" is not supported. Load of media resource videos/Sequence1.mp4 failed. @ http://thesuperheroblueprint.com/
-- [18:47:12.942] 不支持“video/mp4”的指定“type”属性。媒体资源视频/Sequence1.mp4 加载失败。@ http://thesuperheroblueprint.com/
Please help me.. I really need to fix this so bad.. Here is the website..
请帮助我.. 我真的需要解决这个问题.. 这是网站。.
回答by Brijesh Gajjar
MP4 type isn't supported on Firefox! It's only supported in Safari 3.0+, Google Chrome 5.0+ and IE 9.0+! For Firefox you'll need .ogg file or .webm video files as sources! Here is an image containing all supported video formats in HTML 5:
Firefox 不支持 MP4 类型!它仅支持 Safari 3.0+、Google Chrome 5.0+ 和 IE 9.0+!对于 Firefox,您需要 .ogg 文件或 .webm 视频文件作为源!这是一张包含 HTML 5 中所有支持的视频格式的图像:
And for audio support see this pic:
对于音频支持,请参阅此图片:
UPDATE:
更新:
Firefox now supports MP4 H.264 (AAC or MP3) https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
Firefox 现在支持 MP4 H.264(AAC 或 MP3) https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
Note: MP4s encoded with a high profile will not run on lower end hardware, such as low end Firefox OS phones.
注意:使用高配置编码的 MP4 不能在低端硬件上运行,例如低端 Firefox OS 手机。
回答by robertc
Firefox gives the error because it doesn't support video/mp4
, it's nothing to worry about, something else is causing the problem. You could start by removing one of your two preload
attributes although I don't think that's the main problem either.
Firefox 给出错误是因为它不支持video/mp4
,不用担心,其他原因导致了问题。您可以首先删除您的两个preload
属性之一,尽管我认为这也不是主要问题。
If you load the webm
video directlyin Firefox it takes about 30 seconds and after it loads up the play point is right at the end of the video. If you load the ogv
file directlyit appears to play just fine. I would therefore conclude that there's something wrong with the encoding of your webm
file, I'd try encoding it again with some different options.
如果您直接在 Firefox 中加载webm
视频,大约需要 30 秒,加载后播放点就在视频的末尾。如果您直接加载ogv
文件,它似乎播放得很好。因此,我会得出结论,您的webm
文件编码有问题,我会尝试使用一些不同的选项再次对其进行编码。
As a side note, if you can't work out what's up with the encoding, there's really nothing in the video that requires it to be a video. It's basically a video of a slideshow, you might be better off implementing it that way, it would certainly reduce the bandwidth required.
附带说明一下,如果您无法弄清楚编码是怎么回事,那么视频中实际上没有任何内容要求它成为视频。它基本上是幻灯片的视频,您最好以这种方式实现它,它肯定会减少所需的带宽。