Skip to content

Commit 2d77bad

Browse files
committed
Do not replay again on YouTube
1 parent 53bc4f2 commit 2d77bad

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

script.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,11 @@ $(function() {
610610
injectOperationForNetflix(`player.seek(player.getCurrentTime() + ${settings.skipTimeAmount} * 1000)`)
611611
}
612612
else {
613-
player.currentTime += settings.skipTimeAmount;
613+
// To prevent replaying the video from the beginning again if this function is called
614+
// after the video has been played to the end on YouTube.
615+
if ((player.currentTime + settings.skipTimeAmount) <= player.seekable.end(0)) {
616+
player.currentTime += settings.skipTimeAmount
617+
}
614618
}
615619
};
616620

@@ -697,7 +701,9 @@ $(function() {
697701
injectOperationForNetflix(`player.seek(${player.seekable.end(0) * 1000})`)
698702
}
699703
else {
700-
player.currentTime = player.seekable.end(0);
704+
if (player.currentTime < player.seekable.end(0)) {
705+
player.currentTime = player.seekable.end(0)
706+
}
701707
}
702708
};
703709

0 commit comments

Comments
 (0)