Skip to content

Commit

Permalink
Handle video not existing when playback rate being determined
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Nov 27, 2024
1 parent b28c72b commit 14f8ee5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ function waitForNextTimeChange(): Promise<DOMHighResTimeStamp | null> {

function getVirtualTime(): number {
const virtualTime = lastTimeFromWaitingEvent ?? (lastKnownVideoTime.videoTime !== null ?
(performance.now() - lastKnownVideoTime.preciseTime) * getVideo().playbackRate / 1000 + lastKnownVideoTime.videoTime : null);
(performance.now() - lastKnownVideoTime.preciseTime) * (getVideo()?.playbackRate || 1) / 1000 + lastKnownVideoTime.videoTime : null);

if (Config.config.useVirtualTime && !isSafari() && virtualTime
&& Math.abs(virtualTime - getCurrentTime()) < 0.2 && getCurrentTime() !== 0) {
Expand Down

0 comments on commit 14f8ee5

Please sign in to comment.