From 7a4c1907527d602882b70a3c5479da11b05e6fdd Mon Sep 17 00:00:00 2001 From: qq_59556663 Date: Mon, 23 Oct 2023 17:00:00 +0800 Subject: [PATCH] Mon Oct 23 17:00:00 CST 2023 inscode --- src/App.vue | 34 ++++++++++++++++++++++++---------- src/uitls/preview.ts | 10 +++++----- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/App.vue b/src/App.vue index 26ec4ac..2dd63e0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,17 @@ \ No newline at end of file diff --git a/src/uitls/preview.ts b/src/uitls/preview.ts index be9189d..9f9c0e5 100644 --- a/src/uitls/preview.ts +++ b/src/uitls/preview.ts @@ -1,11 +1,11 @@ //获取本地图片/视频链接 async function preview(e: any) { - const buffer = await e.target.files[0].arrayBuffer(); - + return URL.createObjectURL(new Blob([buffer])); + } /** @@ -39,10 +39,10 @@ function intercpt(calssname: HTMLElement) { * 截取本地视频某一帧 * @ramerate */ -function ramerate(url: string, width: string, height: string) { +function ramerate(url: string, width: string, height: string,mun:number) { return new Promise(function (resolve, reject) { const video = document.createElement('video') - video.currentTime = 8 // 指定帧数 + video.currentTime =mun|| 8 // 指定帧数 video.setAttribute('mut', 'true') video.setAttribute('crossOrigin', 'anonymous') // 处理跨域 video.setAttribute('crossOrigin', 'anonymous') // 处理跨域 @@ -82,4 +82,4 @@ function convert(url: any, name: string) { return new File([u8arr], name || 'png', { type: mime }) } -export {preview ,intercpt,convert,ramerate} \ No newline at end of file +export { preview, intercpt, convert, ramerate } \ No newline at end of file -- GitLab