Commit 77142096 by Tianqing Liu

feat: 只有播放,才可以点击截图

1 parent a81a89f0
<template>
<div class="extension-page">
<div class="j-player-wrapper">
<vion-player ref="vionPlayer" :watermarkText="params.watermarkText" :hideControls="false" :showPtz="false" :isXCXPage="true" @magnificationChange="magnificationChange"/>
<vion-player
ref="vionPlayer"
:watermarkText="params.watermarkText"
:hideControls="false"
:showPtz="false"
:isXCXPage="true"
@magnificationChange="magnificationChange"
@play-success="handlePlaySuccess"
/>
</div>
<!-- 时间线组件 -->
<div class="extension-time-box">
<videoTime v-if="params.gateUnid" ref="videoTime" @videoTimeChange="videoTimeChange" @ptzControlClick="ptzControlClick" :dateFormatType="dateFormatType" :magnification="magnification" :ptzEnable="params.ptzEnable" :gateUnid="params.gateUnid"/>
<videoTime
v-if="params.gateUnid"
ref="videoTime"
@videoTimeChange="videoTimeChange"
@ptzControlClick="ptzControlClick"
:dateFormatType="dateFormatType"
:magnification="magnification"
:ptzEnable="params.ptzEnable"
:gateUnid="params.gateUnid"
/>
</div>
</div>
</template>
<script>
import { getUrlParams } from './utils';
// import { getUrlParams } from './utils';
import vionPlayer from '../vionPlayer/index.vue';
import videoTime from './videoTime.vue';
import moment from "moment";
import tourApi from '@/api';
import {
Toast
} from 'vant';
import { Toast } from 'vant';
/**
* 此部分负责:
* 1. iframe通信postmessage
......@@ -73,6 +88,11 @@ export default {
setPTZEnable(status) {
this.$refs.videoTime.setPTZEnable(status)
},
handlePlaySuccess() {
console.log('handlePlaySuccess-extension')
// 播放成功
this.$emit('play-success');
},
// 播放倍率改变
magnificationChange(val) {
this.magnification = val
......
......@@ -110,11 +110,12 @@ export default {
this.player.height = data.height;
});
/* playerIns.on('play', (flag) => {
console.log('on-play', flag);
this.playing = true;
playerIns.on('play', () => {
console.log('on-play-success');
this.$emit('play-success');
// this.playing = true;
});
playerIns.on('pause', (flag) => {
/* playerIns.on('pause', (flag) => {
console.log('on-pause', flag);
this.playing = false;
}); */
......
......@@ -3,13 +3,20 @@
<van-action-bar>
<van-action-bar-icon icon="video-o" text="场景" @click="onClickIcon('scene')" />
<van-action-bar-icon v-if="props.ptzEnable" icon="aim" text="云台" @click="onClickIcon('ptz')" />
<van-action-bar-button type="danger" color="#387CF5" style="height: 44px" text="截图巡检" @click="onClickButton" />
<van-action-bar-button
type="danger"
color="#387CF5"
style="height: 44px"
text="截图巡检"
:disabled="!screenshotEnable"
@click="onClickButton"
/>
</van-action-bar>
</div>
</template>
<script setup>
const props = defineProps(['ptzEnable'])
const props = defineProps(['ptzEnable', 'screenshotEnable'])
const emit = defineEmits(['screenshot'])
function onClickIcon(type) {
......
......@@ -160,7 +160,11 @@
</div>
</div>
<div v-else>
<livePlayer ref="vionPlayer" @screenshotEnd="screenshotEnd"></livePlayer>
<livePlayer
ref="vionPlayer"
@play-success="handlePlaySuccess"
@screenshotEnd="screenshotEnd"
></livePlayer>
<!--TODO: 暂时不需要了-->
<div style="display: none">
<div class="tour-btns" v-if="paramObj.type == 'titem'">
......@@ -293,12 +297,14 @@
<VideoController
v-if="originUser === 'record'"
:ptz-enable="ptzEnableInController"
:screenshotEnable="isAllowScreenshot"
@screenshot="handleScreenshot"
@showMonitor="navBack"
@showPTZ="handleShowPTZ"
/>
<ProcessingController
v-else
:screenshotEnable="isAllowScreenshot"
@screenshot="handleScreenshot"
@back="handleBack"
/>
......@@ -320,8 +326,13 @@ import parse from "url-param-parser";
// let url = 'https://store.keliuyun.com/video/?userId=8840&atoken=8eaf1373-654b-4cf2-a3c7-f90d42cba574&type=undefined&id=632&name=会议室门口&mallId=9217&mallName=河南分公司&bookmark=false&channelNo=4&deviceSerial=F16423875&gateUnid=cf21f4a8-65c6-11ee-837e-00163e143ecd&ptzEnable=0&aiChannelId=&mallOrgName=办公室&accountId=337&terminalType=devtools&newLevel=' // 萤石
const isAllowScreenshot = ref(false)
function handlePlaySuccess() {
console.log('handlePlaySuccess-video')
isAllowScreenshot.value = true;
}
function handleScreenshot() {
console.log('handleScreenshot')
console.log('handleScreenshot-video')
isAllowScreenshot.value = false;
goCaptureImg()
}
// const paramObj = parse(url).search || {}
......@@ -936,6 +947,9 @@ const goCaptureImg = () => {
};
// 截图出口
const screenshotEnd = (imgData) => {
// 截图成功后,设置
isAllowScreenshot.value = true;
console.log(imgData);
let reg = new RegExp("data:image/jpeg;base64,");
let regPng = new RegExp("data:image/png;base64,");
......
......@@ -2,12 +2,12 @@
<div class="processing-container">
<van-button type="default" size="normal" style="margin-right: 10px;" @click="handleBack">返回</van-button>
<!--icon="plus"-->
<van-button type="primary" size="normal" @click="handleScreenshot">截图反馈</van-button>
<van-button type="primary" size="normal" :disabled="!screenshotEnable" @click="handleScreenshot">截图反馈</van-button>
</div>
</template>
<script setup>
const props = defineProps(['originUser']) // processing origin
const props = defineProps(['originUser', 'screenshotEnable']) // processing origin
const emit = defineEmits(['screenshot', 'back'])
function handleScreenshot(type) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!