Keep segments when skipping

This commit is contained in:
TC
2021-06-03 22:15:36 +02:00
parent ca64a77ed0
commit 4a60aa9f20

View File

@ -12,16 +12,16 @@ module.exports = () => {
}); });
ontimeupdate((videoElement) => { ontimeupdate((videoElement) => {
if ( currentSegments.forEach((segment) => {
currentSegments.length > 0 && if (
videoElement.currentTime >= currentSegments[0][0] && videoElement.currentTime >= segment[0] &&
videoElement.currentTime <= currentSegments[0][1] videoElement.currentTime <= segment[1]
) { ) {
videoElement.currentTime = currentSegments[0][1]; videoElement.currentTime = segment[1];
const skipped = currentSegments.shift(); if (is.dev()) {
if (is.dev()) { console.log("SponsorBlock: skipping segment", segment);
console.log("SponsorBlock: skipping segment", skipped); }
} }
} });
}); });
}; };