Revert "Cache videos"

This reverts commit 26d2627a1c.
This commit is contained in:
William Casarin
2024-04-25 14:54:04 -07:00
parent 052ea9b727
commit 76529f69d0
5 changed files with 1 additions and 127 deletions

View File

@@ -33,7 +33,7 @@ struct DamusVideoPlayer: View {
else {
mute = nil
}
_model = StateObject(wrappedValue: DamusVideoPlayerViewModel.cached_video_model(url: url, video_size: video_size, controller: controller, mute: mute))
_model = StateObject(wrappedValue: DamusVideoPlayerViewModel(url: url, video_size: video_size, controller: controller, mute: mute))
self.visibility_tracking_method = visibility_tracking_method
self.style = style
}

View File

@@ -57,12 +57,6 @@ final class DamusVideoPlayerViewModel: ObservableObject {
}
}
static func cached_video_model(url: URL, video_size: Binding<CGSize?>, controller: VideoController, mute: Bool? = nil) -> Self {
let maybe_cached_url = (try? VideoCache.standard?.maybe_cached_url_for(video_url: url)) ?? url
Log.info("Loading video with URL: %s",for: .render, maybe_cached_url.absoluteString)
return Self.init(url: maybe_cached_url, video_size: video_size, controller: controller, mute: mute)
}
init(url: URL, video_size: Binding<CGSize?>, controller: VideoController, mute: Bool? = nil) {
self.url = url
player_item = AVPlayerItem(url: url)