Html视频播放器播放声音,但不播放视频 [英] Html Video player plays sound but not video

查看:169
本文介绍了Html视频播放器播放声音,但不播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在制作网页的过程中,并试图插入视频。视频播放器加载正常,您可以按播放,但只播放音频,不播放视频。 (当用chrome预览时)
当在firefox中查看时,它正常工作



我的代码如下...

 < video width =600height =400controls> 
< source src =ds2.mp4type =video / mp4>
< source src =ds2.ogvtype =video / ogv>
< source src =ds2.webmtype =video / webm>

您的浏览器不支持视频标签。

 < /视频> 

我的Doctype是<!Doctype html>



我检查了MIME类型,它的Video / mp4。但是,其中一个MIME请求是红色的,并且已被取消(使用谷歌开发工具进行网络检查时)



我使用微软表达式web 4(因为它是相关的) p>

如果我忽略了任何重要信息,请让我知道并更新这篇文章:)感谢您的帮助:)

解决方案

你的问题与文件编码有关。 HTML5只支持很少的类型,不幸的是,每个浏览器只能播放这个窄列表的一部分。



如果您将mp4文件转换为 H。 264 编码它可以在Chrome和IE9及更高版本上运行,但显然由于专利问题,firefox不支持它,但是如果操作系统可以播放,它将播放它。这真的很烦人,仍然需要使用播放器才能在不支持的浏览器中播放文件。


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

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>

My Doctype is <!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)

Im using microsoft expression web 4 (incase it is relevant)

If i've neglected any important information please let me know and ill update the post :) Thanks in advance for your help :)

解决方案

Your problem is with the file encoding. HTML5 supports very few types and, sadly, every browser can play only part of this narrow list.

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.

这篇关于Html视频播放器播放声音,但不播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆