mirror of https://github.com/FreeTubeApp/FreeTube
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:
parent
29f511372f
commit
c7a99066da
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue