Fork me on GitHub

页面中插入视频兼容ie8以上的浏览器

有时候页面中需要插入视频,如果不考虑ie8的话;就是直接用h5标签<video></video>就可以了;

但是有的时候需求是需要考虑ie8,这样我们就可以用插件,这种videojs的插件

使用

<!DOCTYPE html>
<html>
<head>
  <title>Video.js | HTML5 Video Player</title>

  <!-- Chang URLs to wherever Video.js files will be hosted -->
  <link href="video-js.css" rel="stylesheet" type="text/css">
  <!-- video.js must be in the <head> for older IEs to work. -->
  <script src="video.js"></script>

  <!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
  <script>
    videojs.options.flash.swf = "video-js.swf";//不兼容h5的浏览器
  </script>


</head>
<body>

  <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://vjs.zencdn.net/v/oceans.mp4" type='video/mp4' />
    <source src="http://vjs.zencdn.net/v/oceans.webm" type='video/webm' />
    <source src="http://vjs.zencdn.net/v/oceans.ogv" type='video/ogg' />
    <track kind="captions" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
    <track kind="subtitles" src="demo.captions.vtt" srclang="en" label="English"></track><!-- Tracks need an ending tag thanks to IE9 -->
  </video>

</body>
</html>

demo:

https://github.com/GainLoss/video-videojs

http://www.jq22.com/jquery-info404

官方文档:

https://github.com/videojs/video.js/blob/stable/docs/index.md

 

posted @ 2017-02-27 13:42  zhang_yx  阅读(828)  评论(0编辑  收藏  举报