Don't reload broken thumbnails

This commit is contained in:
Arkadiusz Fal
2021-10-25 00:26:25 +02:00
parent 1ca7b04e89
commit 3a092fc411
7 changed files with 82 additions and 27 deletions

View File

@@ -148,9 +148,6 @@ final class PlayerModel: ObservableObject {
of video: Video,
preservingTime: Bool = false
) {
#if !os(macOS)
try? AVAudioSession.sharedInstance().setActive(false)
#endif
resetSegments()
sponsorBlock.loadSegments(videoID: video.videoID)
@@ -353,13 +350,12 @@ final class PlayerModel: ObservableObject {
}
@objc func itemDidPlayToEndTime() {
#if !os(macOS)
try? AVAudioSession.sharedInstance().setActive(false)
#endif
currentItem.playbackTime = playerItemDuration
if queue.isEmpty {
#if !os(macOS)
try? AVAudioSession.sharedInstance().setActive(false)
#endif
addCurrentItemToHistory()
resetQueue()
#if os(tvOS)

View File

@@ -0,0 +1,25 @@
import Foundation
final class ThumbnailsModel: ObservableObject {
@Published var unloadable = Set<URL>()
func insertUnloadable(_ url: URL) {
unloadable.insert(url)
}
func isUnloadable(_ url: URL!) -> Bool {
guard !url.isNil else {
return true
}
return unloadable.contains(url)
}
func loadableURL(_ url: URL!) -> URL? {
guard !url.isNil else {
return nil
}
return isUnloadable(url) ? nil : url
}
}