diff --git a/src/hooks/usePlaybackWebSocket.ts b/src/hooks/usePlaybackWebSocket.ts index a22755f..6b8a4fb 100644 --- a/src/hooks/usePlaybackWebSocket.ts +++ b/src/hooks/usePlaybackWebSocket.ts @@ -13,6 +13,11 @@ type PlaybackMessage = { data: any; }; +type PlaybackSceneData = { + json: string; + totalDuration: number; +}; + // Hook's return type definition export interface UsePlaybackWebSocketReturn { // Connection status @@ -75,8 +80,9 @@ export function usePlaybackWebSocket(editorService: ShallowRef { latestRobotData.set(robot.id, robot); @@ -119,6 +125,9 @@ export function usePlaybackWebSocket(editorService: ShallowRef { + // 双重保险:在播放前,强制发送一次SEEK指令,确保后端从正确的时间点开始。 + // 这可以防止因后端状态不同步或时序问题导致的播放位置错乱。 + sendCommand(`SEEK:${currentTime.value}`); sendCommand('PLAY'); isPlaying.value = true; }; diff --git a/src/pages/movement-supervision.vue b/src/pages/movement-supervision.vue index 63bcdc8..d8a79b3 100644 --- a/src/pages/movement-supervision.vue +++ b/src/pages/movement-supervision.vue @@ -1,7 +1,7 @@