0.3.1 • Published 4 years ago

vue-video-control v0.3.1

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

vue-video-control npm npm

A html5 video player component of vue.

Include video controller / video preview / power progress bar / danmaku and so on

Install

You can install vue-video-control by npm.

$ npm install vue-video-control

cnpm mirror is recommended if you are in Mainland China.

Getting Started

  • Import vue-video-control at main.js
import VideoControl from 'vue-video-control'

Vue.use(VideoControl)
  • Set options at pages
<template>
  <video-control ref="videoControl" class="video-control" :options="videoOptions"></video-control>
</template>

<script>
  export default {
    data () {
      return {
        videoOptions: {
          src: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
        }
      }
    }
  }
</script>

Options

optionstypedefaultinstruction
srcstring''Indicates media URL
autoplaybooleanfalseDo auto play the video
posterstring''The poster image url of video
control.showbooleantrueDisplay control bar
control.focusPreview.showbooleanfalseDisplay focus preview bar
control.focusPreview.dataarray1The data array of focus preview bar
control.videoPreview.showbooleanfalseDisplay video preview image
control.videoPreview.imgUrlstring''The image url of video preview.The image must be an single line sprite image and each of the part should be 160*90. See /public/video-preview.jpg
control.videoPreview.totalNumnumber10Number of the sprite image
control.videoTimer.showbooleantrueDisplay video <current time / duration> timer
control.speedBtn.showbooleantrueDisplay the button to change playback speed
control.speedBtn.speedArrayarray0.5, 0.75, 1, 1.5, 2Playback speed options
control.volumeBtn.showbooleantrueDisplay the button to change volume
control.fullScreenBtn.showbooleantrueDisplay the button to toggle full screen
danmaku.showbooleantrueDisplay the danmaku and danmaku control
danmaku.fontSizenumber25The font size of danmaku
danmaku.rowNumnumber5The maximum number of lines of danmaku
danmaku.speednumber80Rolling speed of danmaku
danmaku.dataarray[]Danmaku data array
danmaku.onSendDanmakuFunctionTriggered after the danmaku is sent

Methods

.refreshOptions()

this.videoOptions.control.focusPreview.data = await getData()
this.videoOptions.control.focusPreview.show = true
this.$refs.videoControl.refreshOptions()

Refresh the component options

Events

play / pause / loadStart / canPlay / canplaythrough / waiting / playing / progress / durationChange / seeking / seeked / timeUpdate / ended / error / rateChange / volumeChange

See Media events

0.3.1

4 years ago

0.2.1

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago