video: remove VideoPlayer and switch to VideoController for cache
Closes: https://github.com/damus-io/damus/pull/1539 Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
3569da5687
commit
9cf53a9e93
@@ -141,7 +141,6 @@ class EventCache {
|
||||
private var replies = ReplyMap()
|
||||
private var cancellable: AnyCancellable?
|
||||
private var image_metadata: [String: ImageMetadataState] = [:] // lowercased URL key
|
||||
private var video_meta: [URL: VideoPlayerModel] = [:]
|
||||
private var event_data: [NoteId: EventData] = [:]
|
||||
|
||||
//private var thread_latest: [String: Int64]
|
||||
@@ -204,30 +203,6 @@ class EventCache {
|
||||
return image_metadata[url.absoluteString.lowercased()]
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func lookup_media_size(url: URL) -> CGSize? {
|
||||
if let img_meta = lookup_img_metadata(url: url) {
|
||||
return img_meta.meta.dim?.size
|
||||
}
|
||||
|
||||
return get_video_player_model(url: url).size
|
||||
}
|
||||
|
||||
func store_video_player_model(url: URL, meta: VideoPlayerModel) {
|
||||
video_meta[url] = meta
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func get_video_player_model(url: URL) -> VideoPlayerModel {
|
||||
if let model = video_meta[url] {
|
||||
return model
|
||||
}
|
||||
|
||||
let model = VideoPlayerModel()
|
||||
video_meta[url] = model
|
||||
return model
|
||||
}
|
||||
|
||||
func parent_events(event: NostrEvent, keypair: Keypair) -> [NostrEvent] {
|
||||
var parents: [NostrEvent] = []
|
||||
|
||||
@@ -289,7 +264,6 @@ class EventCache {
|
||||
|
||||
private func prune() {
|
||||
events = [:]
|
||||
video_meta = [:]
|
||||
event_data = [:]
|
||||
replies.replies = [:]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user