playback.vue 1.6 KB
<template>
  <div class="vion-playerback">
    <!-- 回放 -->
    <iframe ref="vplayer" src="/jplayer/playback.html?ip=52.130.155.147&id=20000000001310000011-1693877405111-1693923756111-1-0" frameborder="0"></iframe>

    <div class="footer">
      <button @click="handleStop">停止播放</button>
      <!-- <button @click="handleScreenshot">抓拍</button> -->
    </div>
  </div>
</template>

<script>
export default {
  name: 'VionPlayback',
  data() {
    return {
      // eslint-disable-next-line
      _playerEl: null,
    }
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this._playerEl = this.$refs.vplayer;
      console.log('vplayer', this._playerEl);
    },
    handleStop() {
      this._playerEl.contentWindow.stopPlayer();
    },
    /* handleScreenshot() {
      const imgData = this._playerEl.contentWindow.screenshotBase64();
      console.log('handleScreenshot', imgData);
    }, */

    handlePlayback() {
      // http://localhost:8080/jplayer/index.html?ip=52.130.155.147&id=20000000001310000005
      console.log('handlePlayback');
      const ip = '52.130.155.147';
      const id = '20000000001310000005';
      // Tue Sep 05 2023 18:00:13 GMT+0800 (中国标准时间)
      const st = '1693908039201';
      // 当前时间
      const et = new Date().getTime();
      const location = 1;
      this._playerEl.src = `/jplayer/index.html?ip=${ip}&id=${id}-${st}-${et}-${location}-0`;
    },
  }
}
</script>

<style scoped lang="scss">
.vion-playerback {
  > iframe {
    width: 800px;
    height: 480px;
  }
  .footer {
    > button {
      margin-right: 10px;
    }
  }
}
</style>