fix: 前端时钟校准问题

This commit is contained in:
2026-04-18 17:01:10 +08:00
parent f49582536b
commit 9c0e879aec
6 changed files with 235 additions and 4 deletions

View File

@@ -20,6 +20,19 @@ export function fetchVideoStatus() {
return fetchJson<VideoStatus>('/api/video/status/')
}
export async function fetchClockCalibrationSample() {
const response = await fetch(`${API_BASE}/api/clock/calibrate/`, {
cache: 'no-store',
})
if (!response.ok) {
throw new Error(`clock calibration failed: ${response.status} ${response.statusText}`)
}
return response.json() as Promise<{
server_received_unix_ms: number
server_sent_unix_ms: number
}>
}
export function buildVideoFrameUrl(frameKey: number) {
return `${API_BASE}/api/video/frame/?frame=${frameKey}&t=${Date.now()}`
}