aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-11-27 14:00:51 -0500
committerAjay <[email protected]>2024-11-27 14:00:51 -0500
commit14f8ee565a7221f882412356110c9801193b3d65 (patch)
tree05c8aec448b7aa79f70955325bca19bf3d888261 /src
parentb28c72bc523d3c339f8a2e2b817ba6d1694a6e24 (diff)
downloadSponsorBlock-14f8ee565a7221f882412356110c9801193b3d65.tar.gz
SponsorBlock-14f8ee565a7221f882412356110c9801193b3d65.zip
Handle video not existing when playback rate being determined
Diffstat (limited to 'src')
-rw-r--r--src/content.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/content.ts b/src/content.ts
index fe6c4268..222f9514 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -832,7 +832,7 @@ function waitForNextTimeChange(): Promise<DOMHighResTimeStamp | null> {
function getVirtualTime(): number {
const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime !== null ?
- (performance.now() - lastKnownVideoTime.preciseTime) * getVideo().playbackRate / 1000 + lastKnownVideoTime.videoTime : null);
+ (performance.now() - lastKnownVideoTime.preciseTime) * (getVideo()?.playbackRate || 1) / 1000 + lastKnownVideoTime.videoTime : null);
if (Config.config.useVirtualTime && !isSafari() && virtualTime
&& Math.abs(virtualTime - getCurrentTime()) < 0.2 && getCurrentTime() !== 0) {