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; showCategoryGuidelines: boolean;
showCategoryWithoutPermission: boolean; showCategoryWithoutPermission: boolean;
showSegmentNameInChapterBar: boolean; showSegmentNameInChapterBar: boolean;
useVirtualTime: boolean;
// Used to cache calculated text color info // Used to cache calculated text color info
categoryPillColors: { categoryPillColors: {
@@ -200,6 +201,7 @@ const Config: SBObject = {
showCategoryGuidelines: true, showCategoryGuidelines: true,
showCategoryWithoutPermission: false, showCategoryWithoutPermission: false,
showSegmentNameInChapterBar: true, showSegmentNameInChapterBar: true,
useVirtualTime: true,
categoryPillColors: {}, categoryPillColors: {},

View File

@@ -711,7 +711,8 @@ function getVirtualTime(): number {
const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime ? const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime ?
(performance.now() - lastKnownVideoTime.preciseTime) * video.playbackRate / 1000 + lastKnownVideoTime.videoTime : null); (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; return virtualTime;
} else { } else {
return video.currentTime; return video.currentTime;