Html 视频播放器播放声音但不播放视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23325358/
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
Html Video player plays sound but not video
提问by user3578539
Im in the process of making a webpage, and im trying to insert a video. The video player loads fine, and you can press play, but only the audio plays, not the video. (When previewing in chrome) When viewing in firefox it works properly
我正在制作网页,我正在尝试插入视频。视频播放器加载正常,您可以按播放键,但只能播放音频,不能播放视频。(在 chrome 中预览时)在 Firefox 中查看时它可以正常工作
My code is as follows...
我的代码如下...
<video width="600" height="400" controls>
<source src="ds2.mp4" type="video/mp4">
<source src="ds2.ogv" type="video/ogv">
<source src="ds2.webm" type="video/webm">
Your browser does not support the video tag.
您的浏览器不支持 video 标签。
</video>
My Doctype is <!Doctype html>
我的文档类型是 <!Doctype html>
I checked the MIME type, its Video/mp4. however, one of the mime requests is in red and cancelled (When checking with google dev tools networking)
我检查了 MIME 类型,它的 Video/mp4。但是,其中一个 mime 请求是红色的并被取消(使用谷歌开发工具网络检查时)
Im using microsoft expression web 4 (incase it is relevant)
我使用 microsoft expression web 4(以防万一它是相关的)
If i've neglected any important information please let me know and ill update the post :) Thanks in advance for your help :)
如果我忽略了任何重要信息,请让我知道并更新帖子:) 在此先感谢您的帮助:)
回答by Gil
Your problem is with the file encoding. HTML5 supports very few types and, sadly, every browser can play only part of this narrow list.
您的问题在于文件编码。HTML5 支持的类型很少,遗憾的是,每个浏览器只能播放这个狭窄列表中的一部分。
If you convert your mp4 file to H.264
encoding it will work on chrome and IE9 and above, but apparently due to patent issues, firefox does not support it but will play it if the OS can play it. This is really annoying and still require the use of players in order to play files in not-supported browsers.
如果您将 mp4 文件转换为H.264
编码,它可以在 chrome 和 IE9 及更高版本上运行,但显然由于专利问题,firefox 不支持它,但如果操作系统可以播放它就会播放它。这真的很烦人,并且仍然需要使用播放器才能在不受支持的浏览器中播放文件。