From 4e04c1608d0ec1ffe72d5f94dbdfbbc664618480 Mon Sep 17 00:00:00 2001 From: samuelmaddock Date: Sat, 4 Jul 2020 23:42:48 -0400 Subject: [PATCH] fix: use correct order of operations for applying clock skew fix --- .../metastream-app/src/lobby/reducers/mediaPlayer.helpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/metastream-app/src/lobby/reducers/mediaPlayer.helpers.ts b/packages/metastream-app/src/lobby/reducers/mediaPlayer.helpers.ts index 55635dd3..7c29fe32 100644 --- a/packages/metastream-app/src/lobby/reducers/mediaPlayer.helpers.ts +++ b/packages/metastream-app/src/lobby/reducers/mediaPlayer.helpers.ts @@ -21,8 +21,8 @@ export const isPlaying = (state: IAppState) => getPlaybackState(state) === Playb const calcTime = (state: IMediaPlayerState) => { switch (state.playback) { case PlaybackState.Playing: - const deltaTime = Date.now() - state.startTime! - const curTime = deltaTime * state.playbackRate + state.serverClockSkew + const deltaTime = Date.now() - (state.startTime! + state.serverClockSkew) + const curTime = deltaTime * state.playbackRate return curTime case PlaybackState.Paused: return state.pauseTime!