From 39f68000e34bca2818a6689f14b350240fa7c209 Mon Sep 17 00:00:00 2001 From: Kyle Maas Date: Sat, 2 Dec 2023 14:26:24 +0000 Subject: [PATCH] Add a workaround for the start time race condition in Video.js --- frontend/src/static/js/components/video-player/VideoPlayer.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/static/js/components/video-player/VideoPlayer.jsx b/frontend/src/static/js/components/video-player/VideoPlayer.jsx index 8cb2d90..723f111 100644 --- a/frontend/src/static/js/components/video-player/VideoPlayer.jsx +++ b/frontend/src/static/js/components/video-player/VideoPlayer.jsx @@ -197,6 +197,8 @@ export function VideoPlayer(props) { const paramT = Number(urlParams.get('t')); const timestamp = !isNaN(paramT) ? paramT : 0; player.player.currentTime(timestamp); + // This is a really hacky way to work around a race condition within Video.js where it thinks it was ready in currentTime() but it actually wasn't so it clears this value: + player.player.cache_.initTime = timestamp; }); return () => {