HTML5 video doesn't work in Firefox and IE when I use video files locally

依然范特西╮ 提交于 2019-12-13 04:42:14

问题


Maybe somebody had faced with such problem? I just have tried to use Video-JS player. First time I used the following markup:

<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" 
        width="640" height="264"
        poster="http://video-js.zencoder.com/oceans-clip.png"
        data-setup="{}">
    <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
    <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
    <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
    <track kind="captions" src="captions.vtt" srclang="en" label="English" />
</video>

Everything was ok. Then I downloaded these three files - mp4, webm and ogv, and placed them locally into the directory of my site. Markup:

<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" 
  width="640" height="264"
  poster="http://video-js.zencoder.com/oceans-clip.png"
  data-setup="{}">
      <source src="/Content/Images/Data/Media/oceans-clip.mp4" type='video/mp4' />
      <source src="/Content/Images/Data/Media/oceans-clip.webm" type='video/webm' />
      <source src="/Content/Images/Data/Media/oceans-clip.ogv" type='video/ogg' />
      <track kind="captions" src="/Scripts/video-js/captions.vtt" srclang="en" 
            label="English" />
</video>

Now it works fine in Chrome, but doesn't work in Firefox and IE. Before I tried to use the other HTML5 player - Leanpack, and I had faced with the same behaviour. What is cause of problem?


回答1:


Your server (even if it's localhost) needs to be set up to provide the correct mime types or the fussier browsers won't play back the files. See dive into html5 for more information.




回答2:


Change the file extension from .ogv to .ogg. It works well.




回答3:


Add the absolute path to the mp4 file and IE9 will play it. See answer on video.js help guide from Jonas



来源:https://stackoverflow.com/questions/10630835/html5-video-doesnt-work-in-firefox-and-ie-when-i-use-video-files-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!