Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Commit

Permalink
Fix LazyImage video coder registration
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jul 18, 2021
1 parent b3f0414 commit f35e7e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Sources/LazyImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public struct LazyImage<Content: View>: View {
}
.onAppear(perform: onAppear)
.onDisappear(perform: onDisappear)
.onChange(of: requestId) { _ in model.load(request) }
.onChange(of: requestId) { _ in load() }
}

@ViewBuilder private var content: some View {
Expand Down Expand Up @@ -232,6 +232,11 @@ public struct LazyImage<Content: View>: View {
model.onFailure = onFailure
model.onCompletion = onCompletion

load()
}

private func load() {
ImageDecoders.Video.register()
model.load(request)
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/LazyImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public final class LazyImageView: _PlatformBaseView {
assert(Thread.isMainThread, "Must be called from the main thread")

if imageView.isVideoRenderingEnabled {
ImageDecoders.Video.register() // TODO: Can the codec also pull the first frame?
ImageDecoders.Video.register()
}

cancel()
Expand Down

0 comments on commit f35e7e5

Please sign in to comment.