Browse Source

Drift logic moved to 200ms or more drift.

refactor/modularize
RUSHIL AMBARISH KADU 6 months ago
parent
commit
07fddc02df
  1. 6
      steps/src/sync.js

6
steps/src/sync.js

@ -216,9 +216,9 @@ export function animationLoop() {
if (now - appState.lastSyncTime > 150) { if (now - appState.lastSyncTime > 150) {
const videoTime = videoPlayer.currentTime; const videoTime = videoPlayer.currentTime;
const drift = Math.abs(currentMediaTime - videoTime); const drift = Math.abs(currentMediaTime - videoTime);
// Resync if drift is > 150ms
if (drift > 0.15) {
// Resync if drift is > 150ms
// Resync if drift is > 200ms
if (drift > 0.2) {
// Resync if drift is > 200ms
console.warn(`Resyncing video. Drift was: ${drift.toFixed(3)}s`); console.warn(`Resyncing video. Drift was: ${drift.toFixed(3)}s`);
videoPlayer.currentTime = currentMediaTime; videoPlayer.currentTime = currentMediaTime;
} }

Loading…
Cancel
Save