修改视频回访 截图方法

This commit is contained in:
lxd 2024-09-18 17:15:07 +08:00
parent 8463a7a36b
commit aa112dd24f

View File

@ -12,8 +12,8 @@
:destroy-on-close="true" :destroy-on-close="true"
> >
<div class="mycontainer"> <div class="mycontainer">
<div class="myleft-div"> <div class="myleft-div" >
<vue3VideoPlay id="videoScreenShot" crossorigin="anonymous" v-bind="options" /> <vue3VideoPlay id="videoScreenShot" crossorign="anonymous" v-bind="options"/>
</div> </div>
<div class="myright-div"> <div class="myright-div">
<el-button <el-button
@ -21,8 +21,7 @@
style="background-color: rgb(28, 176, 117); font-size: 14; color: rgb(255, 255, 255)" style="background-color: rgb(28, 176, 117); font-size: 14; color: rgb(255, 255, 255)"
><el-icon><PictureFilled /></el-icon> </el-button ><el-icon><PictureFilled /></el-icon> </el-button
> >
<canvas id="myCanvas" style="display: none" crossorign="anonymous" ></canvas>
<canvas id="myCanvas" style="display: none"></canvas>
</div> </div>
</div> </div>
</Dialog> </Dialog>
@ -32,7 +31,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { ultrasoniccomApi, insimagescreenshotVO } from '@/api/ultrasoniccom' import { ultrasoniccomApi, insimagescreenshotVO } from '@/api/ultrasoniccom'
import html2canvas from 'html2canvas';
const message = useMessage() // const message = useMessage() //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
@ -53,7 +52,7 @@ const options = reactive({
color: '#409eff', // color: '#409eff', //
title: '', // title: '', //
src: '', // src: '', //
type: 'm3u8', // type:'video/mp4',
muted: false, // muted: false, //
webFullScreen: false, webFullScreen: false,
speedRate: ['0.75', '1.0', '1.25', '1.5', '2.0'], // speedRate: ['0.75', '1.0', '1.25', '1.5', '2.0'], //
@ -69,15 +68,16 @@ const options = reactive({
const GetimgUrl=async ()=> const GetimgUrl=async ()=>
{ {
const data= await ultrasoniccomApi.getImageVideo(id.value) const data= await ultrasoniccomApi.getImageVideo(id.value)
options.src = data options.src = data+'?t='+new Date().getTime()
} }
// //
const capture = () => { const capture = () => {
// videocanvas // videocanvas
const video = document.getElementById('videoScreenShot') const video = document.getElementById('videoScreenShot')
const canvas = document.getElementById('myCanvas') const canvas = document.getElementById('myCanvas')
// //
const targetWidth = 400 // const targetWidth = 400 //
const targetHeight = 400 // const targetHeight = 400 //
@ -104,14 +104,13 @@ const capture = () => {
// canvasdata URLBase64 // canvasdata URLBase64
const imageDataUrl = canvas.toDataURL('image/jpeg', 0.7) // JPEG01 const imageDataUrl = canvas.toDataURL('image/jpeg', 0.7) // JPEG01
saveimage(imageDataUrl) saveimage(imageDataUrl)
// //
// downloadImage(imageDataUrl); // downloadImage(imageDataUrl);
} }
// //
const saveimage = async (imageDataUrl) => { const saveimage = async (imageDataUrl) => {
await ultrasoniccomApi.insimagescreenshot({ id: id.value, imagebase: imageDataUrl }) await ultrasoniccomApi.ftpimage({ id: id.value, imagebase: imageDataUrl })
message.notifySuccess('请刷新右侧图片') message.notifySuccess('请刷新右侧图片')
} }