From bf46c36eca2c0e6db24b430d098996e37b78ceb3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 21 May 2022 21:47:51 +0200 Subject: [PATCH] Don't skip segments that start before 4 seconds To minimize buffering --- Model/Player/Backends/MPVBackend.swift | 2 +- Model/Player/PlayerSponsorBlock.swift | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index 07531953..cafd77c8 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -128,7 +128,7 @@ final class MPVBackend: PlayerBackend { if !preservingTime, let segment = self.model.sponsorBlock.segments.first, - segment.start < 3, + segment.start > 4, self.model.lastSkipped.isNil { self.seek(to: segment.endTime) { finished in diff --git a/Model/Player/PlayerSponsorBlock.swift b/Model/Player/PlayerSponsorBlock.swift index b84b9939..d1d4fdac 100644 --- a/Model/Player/PlayerSponsorBlock.swift +++ b/Model/Player/PlayerSponsorBlock.swift @@ -50,7 +50,8 @@ extension PlayerModel { private func shouldSkip(_ segment: Segment, at time: CMTime) -> Bool { guard isPlaying, !restoredSegments.contains(segment), - Defaults[.sponsorBlockCategories].contains(segment.category) + Defaults[.sponsorBlockCategories].contains(segment.category), + segment.start > 4 else { return false }