feat: media API (video/bbox/thumbnail), UUID unification, dot matrix text, portal fixes, API dictionary V1.3
This commit is contained in:
@@ -55,17 +55,18 @@
|
||||
type: <span class="text-blue-300">{{ hit.id.split('_')[0] }}</span>
|
||||
uuid: <span class="text-purple-300">{{ hit.vid }}</span>
|
||||
</span>
|
||||
<!-- Parent ID Badge -->
|
||||
<span v-if="hit.parent_id" class="bg-yellow-900 text-yellow-300 px-2 py-1 rounded text-sm">
|
||||
parent_id: {{ hit.parent_id }}
|
||||
</span>
|
||||
<!-- Visual Stats Badge -->
|
||||
<span v-if="hit.has_visual_stats" class="bg-cyan-900 text-cyan-300 px-2 py-1 rounded text-sm">
|
||||
📦 Visual
|
||||
</span>
|
||||
<span v-else class="bg-gray-700 text-gray-400 px-2 py-1 rounded text-sm">
|
||||
No Visual
|
||||
Visual
|
||||
</span>
|
||||
<button
|
||||
@click.stop="playChunk(hit)"
|
||||
class="bg-green-700 hover:bg-green-600 px-3 py-1 rounded text-sm transition ml-auto"
|
||||
>
|
||||
▶ Play
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-lg mb-3">{{ hit.text }}</p>
|
||||
<!-- Frame Range (精確定位) -->
|
||||
@@ -102,16 +103,61 @@
|
||||
找不到符合的結果
|
||||
</div>
|
||||
</div>
|
||||
<!-- Player Modal -->
|
||||
<div v-if="player.visible" class="fixed inset-0 bg-black bg-opacity-80 z-50 flex items-center justify-center p-4" @click.self="player.visible = false">
|
||||
<div class="bg-gray-900 rounded-lg w-full max-w-4xl border border-gray-700">
|
||||
<div class="flex items-center justify-between p-4 border-b border-gray-700">
|
||||
<span class="text-white font-semibold">{{ player.title }}</span>
|
||||
<span class="text-gray-400 text-sm">{{ player.start.toFixed(1) }}s - {{ player.end.toFixed(1) }}s</span>
|
||||
<button @click="player.visible = false" class="text-gray-400 hover:text-white text-xl">×</button>
|
||||
</div>
|
||||
<video
|
||||
ref="videoPlayer"
|
||||
:src="player.url"
|
||||
class="w-full"
|
||||
controls
|
||||
autoplay
|
||||
@loadedmetadata="seekToStart"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted, reactive } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { searchVideos } from '@/api/client'
|
||||
import { searchVideos, getCurrentConfig } from '@/api/client'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const videoPlayer = ref<HTMLVideoElement | null>(null)
|
||||
|
||||
const player = reactive({
|
||||
visible: false,
|
||||
url: '',
|
||||
title: '',
|
||||
start: 0,
|
||||
end: 0
|
||||
})
|
||||
|
||||
const playChunk = (hit: SearchHit) => {
|
||||
const config = getCurrentConfig()
|
||||
player.visible = true
|
||||
player.title = hit.text.substring(0, 80)
|
||||
player.start = hit.start
|
||||
player.end = hit.end
|
||||
player.url = `${config.api_base_url}/api/v1/file/${hit.vid}/video#t=${hit.start},${hit.end}`
|
||||
}
|
||||
|
||||
const seekToStart = () => {
|
||||
const el = videoPlayer.value
|
||||
if (el) {
|
||||
el.currentTime = player.start
|
||||
setTimeout(() => { if (el.currentTime > player.end) el.pause() }, (player.end - player.start) * 1000 + 2000)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
localStorage.removeItem('searchState')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user