提交 81a2ca59 编写于 作者: Q qq_59556663

Auto Commit

上级 4ec263ba
...@@ -3,19 +3,24 @@ ...@@ -3,19 +3,24 @@
<input type="file" accept="video/*,image/*" @change="loadFile"> <input type="file" accept="video/*,image/*" @change="loadFile">
<video id="file" width="480" height="270" v-show="showVideo" controls muted autoplay /> <video id="file" width="480" height="270" v-show="showVideo" controls muted autoplay />
<button v-show="showVideo" @click="intercept">截取</button> <button v-show="showVideo" @click="intercept">截取</button>
<input type="text" v-model="inputvalue" placeholder="请输入你要截取第几帧" >
<button v-show="showVideo" @click="intercepts">特定帧率</button>
<img v-if="interceptimg" :src="interceptimg" :preview-src-list="[interceptimg]"/> <img v-if="interceptimg" :src="interceptimg" :preview-src-list="[interceptimg]"/>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
//导入方法 //导入方法
import { preview, intercpt } from '../src/uitls/preview' import { preview, intercpt ,ramerate,convert} from '../src/uitls/preview'
import { ref } from 'vue'; import { ref } from 'vue';
//使用之前导入上述方法 //使用之前导入上述方法
const showVideo = ref(false) const showVideo = ref(false)
// const showImg=ref(false) // const showImg=ref(false)
// 本地渲染 // 本地渲染
const inputvalue=ref('')
const objfile=ref()
async function loadFile(e: any) { async function loadFile(e: any) {
const objres = await preview(e) const objres = await preview(e)
objfile.value=objres
console.log(objres); console.log(objres);
const output = document.querySelector("#file") as HTMLVideoElement const output = document.querySelector("#file") as HTMLVideoElement
showVideo.value = true; showVideo.value = true;
...@@ -28,7 +33,8 @@ async function intercept() { ...@@ -28,7 +33,8 @@ async function intercept() {
const file = document.getElementById('file') as HTMLVideoElement; const file = document.getElementById('file') as HTMLVideoElement;
const res = await intercpt(file) const res = await intercpt(file)
interceptimg.value = res interceptimg.value = res
}
async function intercepts(){
interceptimg.value = await ramerate( objfile.value, '320', '180')
} }
</script> </script>
\ No newline at end of file
...@@ -82,4 +82,4 @@ function convert(url: any, name: string) { ...@@ -82,4 +82,4 @@ function convert(url: any, name: string) {
return new File([u8arr], name || 'png', { type: mime }) return new File([u8arr], name || 'png', { type: mime })
} }
export {preview ,intercpt} export {preview ,intercpt,convert,ramerate}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册