diff --git a/Sources/LazyImage.swift b/Sources/LazyImage.swift index b466300..cc85a23 100644 --- a/Sources/LazyImage.swift +++ b/Sources/LazyImage.swift @@ -180,7 +180,7 @@ public struct LazyImage: 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 { @@ -232,6 +232,11 @@ public struct LazyImage: View { model.onFailure = onFailure model.onCompletion = onCompletion + load() + } + + private func load() { + ImageDecoders.Video.register() model.load(request) } diff --git a/Sources/LazyImageView.swift b/Sources/LazyImageView.swift index 623f4d1..bfb3bbb 100644 --- a/Sources/LazyImageView.swift +++ b/Sources/LazyImageView.swift @@ -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()