zoukankan      html  css  js  c++  java
  • hls.js在vue中的使用

     

     

     

     

     

     

    ---cnpm  install hls.js --save
    
    
    
    <template>
      <video ref="videoRefsmall" :width="(16/9)*smallVideoHieght" :height="smallVideoHieght" controls></video>
    </template>
    
    <script>
      import Hls from 'hls.js';
      import WindowCom from '@/views/home/windows/windowCom'
      import axios from 'axios'
      import OlComminSetting from "@/components/OpenLayersHelper/OlCommonSetting";
    
      export default {
        name: 'deviceWindow',
        components: {WindowCom},
        data() {
          return {
            hls: null,
          }
        },
        props: {
          contentHeight: Number,
          cameraId: String
        },
        watch: {
        },
        computed: {},
        methods: {
          pauseVideo() {
            this.$refs.videoRefsmall.pause();
          },
          playVideo() {
            this.$refs.videoRefsmall.play();
          },
        },
        created() {
    
        },
        mounted() {
          this.hls = new Hls();
          this.hls.attachMedia(this.$refs.videoRefsmall);
    
          this.hls.on(Hls.Events.MANIFEST_PARSED, function () {
            this.$refs.videoRefsmall.pause();
          });
        },
        beforeDestroy() {
          this.hls.stopLoad();
          this.hls.destroy();
        }
      }
    </script>
  • 相关阅读:
    058_从键盘读取一个论坛积分,判断论坛用户等级
    057_统计 Linux 进程相关数量信息
    bzoj3436
    bzoj1202
    bzoj1044
    bzoj2338
    bzoj1854
    bzoj1856
    830C
    bzoj2132
  • 原文地址:https://www.cnblogs.com/yangzhengier/p/14289021.html
Copyright © 2011-2022 走看看