Use video.js play video

1. Download plugin video.js




2. Related tags introduced, including css, js, etc.

    <link href="${path }/static/video/video-js/video-js.css" rel="stylesheet">

    <script src="${path}/static/video/video-js/video.js"></script>
<script>  
  _V_.options.flash.swf = "http://example.com/path/to/video-js.swf"  
</script>


3, html page to play the video section

<video id="example_video_1" class="video-js vjs-default-skin"    
  controls preload="auto" width="800" height="500" style="margin:0 auto"
  poster=""    
  data-setup='{"example_option":true}'>    
 <source src="视频地址" type='video/mp4' />
</video> 

4, support video formats


  <source src= "xxx.mp4"  type= 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'  />  
  <source src= "xxx.webm"  type= 'video/webm; codecs="vp8, vorbis"'  />  
<source src= ".ogv"  type= 'video/ogg; codecs="theora, vorbis"'  />

可以用视频转码工具实现,最好用MP4格式

5、对于ie9以下版本对video标签不支持,请在页面head部分加入以下标签

<script src="http://api.html5media.info/1.1.8/html5media.min.js"></script>
 





Released four original articles · won praise 3 · Views 5065

Guess you like

Origin blog.csdn.net/asonFirst/article/details/51720343