.mp4 file not playing in chrome

前端 未结 5 879
梦如初夏
梦如初夏 2021-02-05 09:13

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 c

5条回答
  •  余生分开走
    2021-02-05 09:53

    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

提交回复
热议问题