vue使用萤石云视频

1、官网下载js包

https://open.ys7.com/mobile/download.html

2、(把下载好的ezuikit.js  js包)放进vue 的 static 下

3、在index.html引入

<script src="./static/ezuikit.js"></script>

4、关闭eslint

config/index.js    

useEslint: false, // (设置为false)

5、组件中使用

···

<template>

  <div class="video-monitor">

      <div class="mainbox-title">

        <div><span class="normal-circle"></span></div>

        <div>

          <span class="title-font">视频监视</span>

        </div>

      </div>

      <div class="video-box">

        <video id="myPlayer" src="http://hls01open.ys7.com/openlive/f01018a141094b7fa138b9d0b856507b.hd.m3u8" width='100%' height="100%" autoplay controls allowfullscreen>

        </video>

      </div>

  </div>

</template>

<script>

export default {

  data(){

    return {

      player:''

    }

  },

  methods:{

    videoOpen(){

      setTimeout(() => {

        this.player = new EZUIKit.EZUIPlayer('myPlayer')

      }, 70);

    }

  },

  mounted(){

    this.videoOpen();

  },

  beforeDestroy(){

    this.player.stop();//关闭视频流

  }

}

</script>

···

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容