Fix: Seek funktioniert jetzt für alle User — report_time überschreibt Seek nicht mehr
- Server: report_time ignoriert Host-Updates für 2s nach einem Seek - Frontend: seekingRef Guard auf 3s erhöht um Sync-Pulse-Rücksetzung zu verhindern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
463b92dc38
commit
dec6be5476
2 changed files with 6 additions and 1 deletions
|
|
@ -459,7 +459,12 @@ async function handleMessage(client: WtClient, msg: any): Promise<void> {
|
|||
if (!client.roomId) return;
|
||||
const room = rooms.get(client.roomId);
|
||||
if (!room) return;
|
||||
// Only accept time reports from the host to avoid conflicts
|
||||
// when multiple users report different times
|
||||
if (room.hostId !== client.id) return;
|
||||
// Ignore if a seek happened recently (within 2s) to prevent overwriting
|
||||
const timeSinceSync = Date.now() - room.lastSyncAt;
|
||||
if (timeSinceSync < 2000) return;
|
||||
room.currentTime = Number(msg.time) || 0;
|
||||
room.lastSyncAt = Date.now();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ export default function WatchTogetherTab({ data }: { data: any }) {
|
|||
dmPlayerRef.current.contentWindow.postMessage(`seek?to=${time}`, 'https://www.dailymotion.com');
|
||||
}
|
||||
setCurrentTime(time);
|
||||
setTimeout(() => { seekingRef.current = false; }, 1000);
|
||||
setTimeout(() => { seekingRef.current = false; }, 3000);
|
||||
}, [wsSend]);
|
||||
|
||||
// ── Host time reporting ──
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue