@@ -772,7 +772,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
772
772
773
773
// Use interval instead of timeout near the end to combat imprecise video time
774
774
const startIntervalTime = forceStartIntervalTime || performance . now ( ) ;
775
- const startVideoTime = Math . max ( currentTime , getCurrentTime ( ) ) ;
775
+ const startVideoTime = Math . max ( currentTime , getVirtualTime ( ) ) ;
776
776
delayTime = ( skipTime ?. [ 0 ] - startVideoTime ) * 1000 * ( 1 / getVideo ( ) . playbackRate ) ;
777
777
778
778
let startWaitingForReportedTimeToChange = true ;
@@ -791,7 +791,7 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
791
791
}
792
792
793
793
const intervalDuration = performance . now ( ) - startIntervalTime ;
794
- if ( intervalDuration + skipBuffer * 1000 >= delayTime || getCurrentTime ( ) >= skipTime [ 0 ] ) {
794
+ if ( intervalDuration + skipBuffer * 1000 >= delayTime || getVirtualTime ( ) + skipBuffer >= skipTime [ 0 ] ) {
795
795
clearInterval ( currentSkipInterval ) ;
796
796
if ( ! isFirefoxOrSafari ( ) && ! getVideo ( ) . muted && ! inMuteSegment ( getCurrentTime ( ) , true ) ) {
797
797
// Workaround for more accurate skipping on Chromium
@@ -842,7 +842,7 @@ function getVirtualTime(): number {
842
842
( performance . now ( ) - lastKnownVideoTime . preciseTime ) * ( getVideo ( ) ?. playbackRate || 1 ) / 1000 + lastKnownVideoTime . videoTime : null ) ;
843
843
844
844
if ( Config . config . useVirtualTime && ! isSafari ( ) && virtualTime
845
- && Math . abs ( virtualTime - getCurrentTime ( ) ) < 0.2 && getCurrentTime ( ) !== 0 ) {
845
+ && virtualTime > getCurrentTime ( ) && virtualTime - getCurrentTime ( ) < 0.2 && getCurrentTime ( ) !== 0 ) {
846
846
return Math . max ( virtualTime , getCurrentTime ( ) ) ;
847
847
} else {
848
848
return getCurrentTime ( ) ;
0 commit comments