All API through Rust proxy, fix unregistered files null uuid, People enhancements
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<button class="close-btn" @click="close">×</button>
|
||||
|
||||
<video ref="videoEl" class="video" controls autoplay @loadedmetadata="onLoaded" @timeupdate="onTimeUpdate">
|
||||
<source :src="videoUrl" type="video/mp4" />
|
||||
<source :src="videoSrc" type="video/mp4" />
|
||||
</video>
|
||||
|
||||
<div class="video-info">
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
|
||||
const props = defineProps<{
|
||||
fileUuid: string
|
||||
@@ -43,15 +44,8 @@ const visible = ref(true)
|
||||
const currentTime = ref(0)
|
||||
const duration = ref(0)
|
||||
const isPlaying = ref(false)
|
||||
|
||||
const CORE_API = 'http://localhost:3002'
|
||||
const API_KEY = 'muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69'
|
||||
|
||||
const videoUrl = computed(() => {
|
||||
const start = props.startTime ?? 0
|
||||
const end = props.endTime ?? 99999
|
||||
return `${CORE_API}/api/v1/file/${props.fileUuid}/video?api_key=${API_KEY}&start_time=${start}&end_time=${end}`
|
||||
})
|
||||
const videoSrc = ref('')
|
||||
const videoLoading = ref(true)
|
||||
|
||||
const hasRange = computed(() => {
|
||||
return props.startTime !== undefined && props.endTime !== undefined
|
||||
@@ -141,8 +135,19 @@ function onKeydown(e: KeyboardEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
document.addEventListener('keydown', onKeydown)
|
||||
try {
|
||||
videoSrc.value = await invoke('get_video_stream', {
|
||||
uuid: props.fileUuid,
|
||||
startTime: props.startTime ?? 0,
|
||||
endTime: props.endTime ?? 99999
|
||||
})
|
||||
} catch (e: any) {
|
||||
console.error('Video stream failed:', e)
|
||||
} finally {
|
||||
videoLoading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user