.mp4文件不能用chrome播放 [英] .mp4 file not playing in chrome

查看:605
本文介绍了.mp4文件不能用chrome播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上显示一段视频。我创建了一个.mp4文件,并使用HTML5视频标签将其添加到html。



问题在于它没有在chrome中显示。我也想知道我怎么一次又一次地重放它。

解决方案

在遇到同样的问题 - here're我的一些想法:


  • 由于Chrome删除了对h264的支持,在某些机器上,使用它编码的mp4视频
    将会不起作用(当在Firebug / Network标签下查看
    时抛出解析器错误 - 与在此处提交
    的问题一致),或根据编码设置崩溃浏览器

  • 它不一致 - 它完全取决于计算机上安装的
    编解码器 - 虽然我的机器上没有遇到这个问题,但
    我们确实在办公室出现了问题(因此我们
    使用这个测试进行测试)
  • 它可能与Quicktime / divX设置有关(
    问题中的机器的Quicktime版本比我的旧版本原生的 - 我们
    不想放弃我们的测试电脑,所以我们没有更新它)。



因为它只影响Chrome浏览器(其他浏览器可以正常使用VideoForEverybody解决方案)我使用的解决方案是:



<对于每个mp4文件,创建一个Theora编码的mp4文件(example.mp4 - > example_c.mp4)
在js后应用:

  if(window.chrome)
$([type = video \\\\ / mp4])。each(function()
{
$(这个).attr('src',$(this).attr('src')。replace(。mp4,_c.mp4));
});

不幸的是,这是一个糟糕的Chrome黑客攻击,但嘿,至少它是有效的。



资料来源: user:eithedog a>



这也有助于: chrome可以播放html5 mp4视频,但html5test表示chrome不支持mp4视频编解码器



请在此检查您的crome版本: html5test


I want to show a video on my website. I have created a .mp4 file and using the HTML5 video tag to add it to the html.

The problem is that it is not being displayed in chrome. I would also like to know how I can replay it again and again.

解决方案

After running into the same issue - here're some of my thoughts:

  • due to Chrome removing support for h264, on some machines, mp4 videos encoded with it will either not work (throwing an Parser error when viewing under Firebug/Network tab - consistent with issue submitted here), or crash the browser, depending upon the encoding settings
  • it isn't consistent - it entirely depends upon the codecs installed on the computer - while I didn't encounter this issue on my machine, we did have one in the office where the issue occurred (and thus we used this one for testing)
  • it might to do with Quicktime / divX settings (the machine in question had an older version of Quicktime than my native one - we didn't want to loose our testing pc though, so we didn't update it).

As it affects only Chrome (other browsers work fine with VideoForEverybody solution) the solution I've used is:

for every mp4 file, create a Theora encoded mp4 file (example.mp4 -> example_c.mp4) apply following js:

if (window.chrome)
    $("[type=video\\\/mp4]").each(function()
    {
        $(this).attr('src', $(this).attr('src').replace(".mp4", "_c.mp4"));
    });

Unfortunately it's a bad Chrome hack, but hey, at least it works.

Source: user: eithedog

This also can help: chrome could play html5 mp4 video but html5test said chrome did not support mp4 video codec

Also check your version of crome here: html5test

这篇关于.mp4文件不能用chrome播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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