vue 2.0 的video插件vue-video-player

第1步:

1.安装插件

npm install vue-video-player -S

第2步:

配置插件 
在main.js里添加如下内容:

import VideoPlayer from 'vue-video-player'
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
Vue.use(VideoPlayer)

 

第3步: 

使用插件 
在vue的组件页面里:

 

 

第4步:

播放按钮的样式设置:

.video-js .vjs-big-play-button{

}

第5步:

视频格式测试:

sources: [
                {
                // type: "video/webm", // ok,用ogg也可打开
                type: "video/ogg", // ok,用webm也可打开
                // type: "video/3gp", //ok
                // type: "video/mp4", // ok
                // type: "video/avi", //打不开
                // type: "video/flv", // 打不开
                // type: "video/mkv", // 打不开
                // type: "video/mov", // 打不开
                // type: "video/mpg", // 打不开
                // type: "video/swf", // 打不开
                // type: "video/ts", // 打不开
                // type: "video/wmv", // 打不开
                // type: "video/vob", // 没转化
                // type: "video/mxf", // 转化出错
                // type: "video/rm", // 转化出错
                src: '/static/video/Video_2018-05-15_105711.webm'//本地测试url地址
                // src: 'http://www.html5videoplayer.net/videos/madagascar3.mp4'//url地址
                }
              ],

第6步:

补充一下:改变视屏播放按钮的样式:

.vjs-custom-skin > .video-js .vjs-big-play-button {

background-color: rgba(0,0,0,0.45);

font-size: 3.5em;

border-radius: 50%;

height: 1.5em !important;

line-height: 2em !important;

margin-top: -1em !important;

width: 1.5em !important;

}

.video-js .vjs-big-play-button .vjs-icon-placeholder:before {

position: absolute;

top: -9px;

left: 0;

width: 100%;

height: 100%;

}

 

你可能感兴趣的:(VUE组件)