修改视频回访 截图方法

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