Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Feb 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -586,6 +590,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]
Expand All @@ -612,14 +621,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) {
Expand Down