插件名称 | vue-video |
---|---|
发布时间 | 2021年1月22日 |
插件作者 | hilongjw |
一个Vue.js组件,可以更轻松地将自定义HTML5视频播放器嵌入到应用程序中。
npm i vue-video --save
// script
import myVideo from 'vue-video'
export default {
data () {
return {
video: {
sources: [{
src: 'http://covteam.u.qiniudn.com/oceans.mp4',
type: 'video/mp4'
}],
options: {
autoplay: true,
volume: 0.6,
poster: 'http://covteam.u.qiniudn.com/poster.png'
}
}
}
},
components: {
myVideo
}
}
<template>
<div id="app">
<div class="container">
<my-video :sources="video.sources" :options="video.options"></my-video>
</div>
</div>
</template>
sources: [{
// video uri
src: 'http://covteam.u.qiniudn.com/oceans.mp4',
// video meta type
type: 'video/mp4'
}]
options: {
// autoplay
autoplay: true,
// default volume
volume: 0.6,
// poster (cover image)
poster: 'http://covteam.u.qiniudn.com/poster.png'
}