https://www.npmjs.com/package/v-tcplayer

vue 写法 插件tcplayer视频播放器的使用

 

<div>

  <VTcPlayer ref="tcPlayer" :options="options" @load="onLoad" @play="onPlay" />

  <V-TcPlayer :options="options" elmId="globalTcPlayer" />

</div>

 

export default {

  data () {

    options: {

      hlsUrl: 'https://lib.baomitu.com/hls.js/0.8.9/hls.min.js', // 0.0.5增加

      width: 800,

      height: 450,

      m3u8: 'http://1251203672.vod2.myqcloud.com/43464984vodtransgzp1251203672/957853b25285890790261970276/v.f230.m3u8',//动态渲染数据时候<VTcPlayer v-if="isshow" ref="tcPlayer" :options="options" @load="onLoad" @play="onPlay" />

    },

  isshow:false //加载完成数据后,再绑定为true

  },

  components: {

    VTcPlayer, //组件

  },

  computed: {

    player () {

      // tcPlayer实例

      return this.$refs.tcPlayer.vTcPlayer

    },

  },

  method: {

    play () {

      this.player.play()

    },

    getCurrentTime () {

      this.player.currentTime()

    },

    loadNewVideo (url) {

      this.player.load(url)

    },

  },

}

 

 

参数说明

options可传入TcPlayer所有参数,事件监听参数listener推荐不传,通过@event方式绑定。 若页面内有多个视频,需传参数elmId

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2021-11-19
  • 2021-12-02
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-12-04
  • 2022-01-01
  • 2021-12-14
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案