wetfish / sync

Synchronize audio and video between friends! Supports HTML5 video, YouTube, and Vimeo
27 stars 8 forks source link

Resync button should track time since last server update #48

Closed itsrachelfish closed 4 years ago

itsrachelfish commented 4 years ago

The server sends a websocket heartbeat to clients every three seconds which update the current media timestamp (vueApp.serverTime). This means that if you click the resync button repeatedly, you will always be brought back to the last time that the server sent you a heartbeat.

To keep clients in sync more accurately, a date object should be saved on the client side each time the server sends a new timestamp. When you click on the resync button, the mediaPlayer.currentTime should be set to vueApp.serverTime plus the difference between the current time and the last heartbeat.