当我在本地使用视频文件时,HTML5视频在Firefox和IE中不起作用 [英] HTML5 video doesn't work in Firefox and IE when I use video files locally

查看:90
本文介绍了当我在本地使用视频文件时,HTML5视频在Firefox和IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许有人遇到过这样的问题?
我刚尝试使用Video-JS播放器。
我第一次使用以下标记:

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>

一切都很好。然后我下载了这三个文件--mp4,webm和ogv,并将它们放在我的网站目录中。加价:

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>

现在它在Chrome中运行良好,但在Firefox和IE中无效。在我尝试使用其他HTML5播放器之前 - Leanpack,我遇到了同样的行为。问题的原因是什么?

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?

推荐答案

您的服务器(即使它是localhost)需要设置为提供正确的mime类型或者较为昂贵的浏览器不会播放文件。 请参阅html5以获取更多信息

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.

这篇关于当我在本地使用视频文件时,HTML5视频在Firefox和IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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