码迷,mamicode.com
首页 > Web开发 > 详细

vue.js 视频播放

时间:2017-07-27 14:34:24      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:lan   export   封装   tar   post   from   save   component   uri   

最近心学习vue.js开发,video开发播放!

使用第三方的封装:https://github.com/hilongjw/vue-video

1. npm install vue-video --save 安装播放第三方插件;

2.

// 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‘
}
 

vue.js 视频播放

标签:lan   export   封装   tar   post   from   save   component   uri   

原文地址:http://www.cnblogs.com/PeterWolf/p/7244473.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!