Skip to content

Commit

Permalink
fix: use correct order of operations for applying clock skew fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Jul 5, 2020
1 parent f238a92 commit 4e04c16
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit 4e04c16

Please sign in to comment.