Skip to content

Commit 97fc817

Browse files
committed
Add flag to disable virtual time
1 parent 9849c34 commit 97fc817

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ interface SBConfig {
6767
showCategoryGuidelines: boolean;
6868
showCategoryWithoutPermission: boolean;
6969
showSegmentNameInChapterBar: boolean;
70+
useVirtualTime: boolean;
7071

7172
// Used to cache calculated text color info
7273
categoryPillColors: {
@@ -200,6 +201,7 @@ const Config: SBObject = {
200201
showCategoryGuidelines: true,
201202
showCategoryWithoutPermission: false,
202203
showSegmentNameInChapterBar: true,
204+
useVirtualTime: true,
203205

204206
categoryPillColors: {},
205207

src/content.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ function getVirtualTime(): number {
711711
const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime ?
712712
(performance.now() - lastKnownVideoTime.preciseTime) * video.playbackRate / 1000 + lastKnownVideoTime.videoTime : null);
713713

714-
if (!isSafari() && virtualTime && Math.abs(virtualTime - video.currentTime) < 0.6 && video.currentTime !== 0) {
714+
if (Config.config.useVirtualTime && !isSafari() && virtualTime
715+
&& Math.abs(virtualTime - video.currentTime) < 0.6 && video.currentTime !== 0) {
715716
return virtualTime;
716717
} else {
717718
return video.currentTime;

0 commit comments

Comments
 (0)