Add flag to disable virtual time

This commit is contained in:
Ajay
2022-10-12 23:48:20 -04:00
parent 9849c34ed3
commit 97fc8174b9
2 changed files with 4 additions and 1 deletions

View File

@@ -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: {},

View File

@@ -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;