From 97fc8174b9df72d7e2c87b97b72de9e053b7356c Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 12 Oct 2022 23:48:20 -0400 Subject: [PATCH] Add flag to disable virtual time --- src/config.ts | 2 ++ src/content.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index f23c60b5..8d5ad5a0 100644 --- a/src/config.ts +++ b/src/config.ts @@ -67,6 +67,7 @@ interface SBConfig { showCategoryGuidelines: boolean; showCategoryWithoutPermission: boolean; showSegmentNameInChapterBar: boolean; + useVirtualTime: boolean; // Used to cache calculated text color info categoryPillColors: { @@ -200,6 +201,7 @@ const Config: SBObject = { showCategoryGuidelines: true, showCategoryWithoutPermission: false, showSegmentNameInChapterBar: true, + useVirtualTime: true, categoryPillColors: {}, diff --git a/src/content.ts b/src/content.ts index 104127fe..8f75954f 100644 --- a/src/content.ts +++ b/src/content.ts @@ -711,7 +711,8 @@ function getVirtualTime(): number { const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime ? (performance.now() - lastKnownVideoTime.preciseTime) * video.playbackRate / 1000 + lastKnownVideoTime.videoTime : null); - if (!isSafari() && virtualTime && Math.abs(virtualTime - video.currentTime) < 0.6 && video.currentTime !== 0) { + if (Config.config.useVirtualTime && !isSafari() && virtualTime + && Math.abs(virtualTime - video.currentTime) < 0.6 && video.currentTime !== 0) { return virtualTime; } else { return video.currentTime;