Allows sponsor segments to be watched even if Auto Skip is enabled (#3116)

* Allows sponsor segments to be watched in Auto Skip mode

* 'b': only jump back to segments configured to be auto-skipped

* Remove 'b' keyboard shortcut
This commit is contained in:
Lodka Sawhet 2023-02-05 19:47:02 +00:00 committed by GitHub
parent 29f511372f
commit c7a99066da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 4 deletions

View File

@ -109,6 +109,10 @@ export default defineComponent({
showStatsModal: false,
statsModalEventName: 'updateStats',
usingTouch: false,
// whether or not sponsor segments should be skipped
skipSponsors: true,
// countdown before actually skipping sponsor segments
skipCountdown: 1,
dataSetup: {
fluid: true,
nativeTextTracks: false,
@ -589,6 +593,11 @@ export default defineComponent({
this.skipSponsorBlocks(skipSegments)
})
this.player.on('seeking', () => {
// disabling sponsors auto skipping when the user manually seeks
this.skipSponsors = false
})
skipSegments.forEach(({
category,
segment: [startTime, endTime]
@ -615,14 +624,23 @@ export default defineComponent({
skippedCategory = category
}
})
if (newTime !== null && Math.abs(duration - currentTime) > 0.500) {
if (this.skipSponsors && newTime !== null && Math.abs(duration - currentTime) > 0.500) {
if (this.sponsorSkips.autoSkip[skippedCategory]) {
if (this.sponsorBlockShowSkippedToast) {
this.showSkippedSponsorSegmentInformation(skippedCategory)
if (this.skipCountdown === 0) {
if (this.sponsorBlockShowSkippedToast) {
this.showSkippedSponsorSegmentInformation(skippedCategory)
}
this.player.currentTime(newTime)
} else {
this.skipCountdown--
}
this.player.currentTime(newTime)
}
}
// restoring sponsors skipping default values
if (newTime === null && !this.skipSponsors) {
this.skipSponsors = true
this.skipCountdown = 1
}
},
showSkippedSponsorSegmentInformation(category) {