1.1.5 • Published 2 years ago

vue-live-video v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

NPM

npm i vue-live-video

Yarn

yarn add vue-live-video

Use it

Quick start

<template>
  <live-video @on-zoom="zoomEvent" src="http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8">
</template>  

<script>
import liveVideo from 'vue-live-video'
export default {
  components: { liveVideo },
  methods: {
    zoomEvent(data) { //获取框选器放大坐标
      let postData = {
        startX: (data.startXRatio * 255).toFixed(0),
        startY: (data.startYRatio * 255).toFixed(0),
        endX: (data.endXRatio * 255).toFixed(0),
        endY: (data.endYRatio * 255).toFixed(0),
      }
    },
  }
}
</script>

Usage

<template>
    <live-video
      ref="video" 
      @on-zoom="zoomEvent"
      width="900px" 
      height="590px"
      rectAvailableSize="5"
      rectStrokeColor="#fcf63c"
      rectStrokeWidth="1"
      rectFillStyle="rgba(0, 0, 0, .2)" 
      rectCleanDelay="2000"
      src="http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8"
    >
</template>  

<script>
import liveVideo from 'vue-live-video'
export default {
  components: { liveVideo },
  data() {
    return {
      postData: {},
    }
  },
  methods: {
    reset() {
      this.$refs.video.reset(true) //框选器重置
    },
    pause() {
      let video = this.$refs.video 
      if (video.isSelectorDisabled()) { 
        video.enableSelector() //禁用框选器
      } else {
        video.disableSelector() //启用框选器
      }
    },
    zoomEvent(data) { //获取框选器放大坐标
      console.info(data)
      this.postData = {
        startX: (data.startXRatio * 255).toFixed(0), //处理为接口需要比例参数
        startY: (data.startYRatio * 255).toFixed(0),
        endX: (data.endXRatio * 255).toFixed(0),
        endY: (data.endYRatio * 255).toFixed(0),
      }
    },
  },
  mounted() {
    let video = this.$refs.video.getVideo() //获取videoJs播放控件
    video.on('loadstart', () => {
      console.log('开始请求数据')
    })
    video.on('progress', () => {
      console.log('正在请求数据')
    })
    video.on('loadedmetadata', () => {
      console.log('获取资源长度完成 ')
    })
    video.on('canplaythrough', () => {
      console.log('视频源数据加载完成')
    })
    video.on('waiting', () => {
      console.log('等待数据')
    })
    video.on('play', () => {
      console.log('视频开始播放')
    })
  },
}
</script>
Props
参数默认说明
width580px播放器宽
height480px播放器高
rectAvailableSize5框选器最小有效长宽
rectStrokeColor#fcf63c框选器边框颜色
rectStrokeWidth1框选器边框粗细
rectFillStyle框选器填充颜色
rectCleanDelay120框选器延时消失时间,设置为0则不消失,单位毫秒
srchls流播放地址,支持动态更换
Events
事件名说明
on-zoom框选器选定触发,接收选取4个坐标
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago