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.
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 tovueApp.serverTime
plus the difference between the current time and the last heartbeat.