Reset sponsorblock segments for local videos

This commit is contained in:
Arkadiusz Fal 2022-12-04 00:35:07 +01:00
parent 33abe4d487
commit 7a2dcc3cf1
2 changed files with 12 additions and 1 deletions

View File

@ -388,6 +388,10 @@ final class PlayerModel: ObservableObject {
}
}
if video.isLocal {
resetSegments()
}
(withBackend ?? backend).playStream(
stream,
of: video,
@ -436,7 +440,9 @@ final class PlayerModel: ObservableObject {
changeActiveBackend(from: activeBackend, to: backend)
}
guard let stream = (((availableStreams.count == 1 && availableStreams.first!.isLocal) ? availableStreams.first : nil) ?? streamByQualityProfile),
let localStream = (availableStreams.count == 1 && availableStreams.first!.isLocal) ? availableStreams.first : nil
guard let stream = localStream ?? streamByQualityProfile,
let currentVideo
else {
return

View File

@ -80,6 +80,11 @@ final class SponsorBlockAPI: ObservableObject {
}
}
func reset() {
videoID = nil
segments = []
}
private func requestSegments(categories: Set<String>, completionHandler: @escaping () -> Void = {}) {
guard let url = skipSegmentsURL, !categories.isEmpty else {
return