ensure that tauri api works

This commit is contained in:
polv committed 2026-01-25 12:50:47 +07:00
1 parent ffb6474c08
commit fc58e68ad7
6 files changed
+565 -9

No files matched your search

@@ -8,7 +8,9 @@
</template>
<script setup lang="ts">
import { ref, useTemplateRef, VNodeRef } from 'vue'
import { ref, useTemplateRef } from 'vue'
import { invoke } from "@tauri-apps/api/core";
import { listen } from '@tauri-apps/api/event';
const q = ref('')
const videoSrc = ref('')
@@ -19,15 +21,18 @@ function onSubmit(ev: SubmitEvent) {
if (!q.value) return
videoSrc.value = '/public/' + q.value
videoSrc.value = '/' + q.value
}
interface SeekQEvent {
t: number
}
function onVideoLoad() {
const { hot } = import.meta as any
hot.send('download-q', { q: q.value.replace(/\.[a-z0-9]+$/, '') })
invoke('download_q', { q: q.value.replace(/\.[a-z0-9]+$/, '') })
hot.on('seek-q', ({ t }: { t: number }) => {
videoEl.value!.currentTime = t;
listen<SeekQEvent>('seek_q', (ev) => {
videoEl.value!.currentTime = ev.payload.t;
})
}
@@ -39,8 +44,7 @@ function onSeeked() {
const ctx = c.getContext('2d')!;
ctx.drawImage(v, 0, 0);
const { hot } = import.meta as any
hot.send('timed-q', { q: q.value.replace(/\.[a-z0-9]+$/, ''), t: videoEl.value!.currentTime, data: c.toDataURL('image/png') })
invoke('timed_q', { q: q.value.replace(/\.[a-z0-9]+$/, ''), t: videoEl.value!.currentTime, data: c.toDataURL('image/png') })
}
</script>