fix:真实视频流还没接通,页面就会稳定显示“未实时获取真实值”
This commit is contained in:
@@ -10,22 +10,25 @@ const props = defineProps<{
|
||||
|
||||
const frameUrl = ref(buildVideoFrameUrl(0))
|
||||
const currentFps = computed(() => props.video?.fps ?? 30)
|
||||
const canRequestFrames = computed(() => props.video == null || props.video.available)
|
||||
const canRequestFrames = computed(() => props.video?.available === true)
|
||||
const modeLabel = computed(() => {
|
||||
if (!props.video) {
|
||||
return '--'
|
||||
return '正在获取视频状态'
|
||||
}
|
||||
if (props.video.source_mode === 'omnisocket-jpeg-live') {
|
||||
return `${props.video.fps} FPS 实时接收`
|
||||
}
|
||||
if (props.video.source_mode === 'omnisocket-waiting') {
|
||||
return '等待 OmniSocket 实时帧'
|
||||
}
|
||||
if (props.video.source_mode === 'sample-jpeg-frame-loop') {
|
||||
return `${props.video.fps} FPS 本地演示`
|
||||
return '未实时获取真实值'
|
||||
}
|
||||
return `${props.video.fps} FPS`
|
||||
})
|
||||
const placeholderText = computed(() => {
|
||||
if (!props.video) {
|
||||
return '正在获取视频状态...'
|
||||
}
|
||||
return '未实时获取真实值'
|
||||
})
|
||||
|
||||
let frameTimer: number | null = null
|
||||
let frameKey = 0
|
||||
@@ -90,7 +93,7 @@ watch([currentFps, canRequestFrames], () => {
|
||||
alt="Robot jpeg frame stream"
|
||||
/>
|
||||
<div v-else class="video-placeholder">
|
||||
正在等待 OmniSocket 实时 JPEG 帧接入...
|
||||
{{ placeholderText }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,8 +109,8 @@ watch([currentFps, canRequestFrames], () => {
|
||||
</div>
|
||||
|
||||
<p class="hint">
|
||||
这里始终按固定频率逐张请求 Django 返回的单帧 JPEG,不依赖 MJPEG。只要后端已经收到
|
||||
OmniSocket 里的真实 JPEG 帧,这个组件就会直接显示实时画面。
|
||||
这里只有在后端已经收到 OmniSocket 的真实 JPEG 帧时,才会开始逐帧请求并显示画面。
|
||||
如果当前没有真实帧,页面会保持占位提示,不再回退测试视频流。
|
||||
</p>
|
||||
|
||||
<p class="hint subtle">
|
||||
|
||||
Reference in New Issue
Block a user