1.1.4 • Published 4 years ago

vue-player-media v1.1.4

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

vue-player-media

基于 Vue 的视频播放器(支持播放mp4、m3u8、swf、flv)

安装

npm

$ npm install vue-player-media -S

use

main.js:

import Vue from 'vue'
import App from './App.vue'
import VuePlayer from 'vue-player-media'
Vue.use(VuePlayer)

new Vue({
  el: '#app',
  components: {
    App
  }
})

explain

*因为flv.js本身的问题,项目中想播放flv格式视频,(我)目前采用的是这种方式

使用方式: 1把flv.js静态资源放到自己项目文件夹(flv静态资源地址:https://github.com/IT-Rafi/vue-player-media/tree/master/static) 2.在项目中的main.js里引入 main.js:

播放器容器大小可自己设置

window.flv = require('flv.js')

new Vue({
  el: '#app',
  components: {
    App
  }
})

Example

template

  <vue-player 
    :id="'detailplayer'" 
    :type="type" 
    :auto="false" 
    :isSwf="false" 
    :src="video_url" 
    :height="'338px'">
  </vue-palyer>

script

export default {
  data () {
    return {
      type:'mp4',
      video_url:'https://v-cdn.zjol.com.cn/276985.mp4'
    }
  },
  methods: {
    //获取视频时长
    getVtime (duration) {
      console.log(duration)
    }
  }
}

Props

prop 描述类型默认值
id元素idstring''
type视频类型stringmp4
auto是否自动播放Booleanfasle
isSwf是否为swf格式Booleanfalse
src播放地址string
height播放器高度stringauto

Methods

方法名类型描述
getVtimestring获取视频时长(swf不可获取)
1.1.4

4 years ago

1.1.1

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago