From 080ee3296e23a0a135637ffef623e4318784e317 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 8 Aug 2024 11:15:22 +0200 Subject: [PATCH] Update LoopPlayerMultiPlatform.swift --- .../view/loop/main/LoopPlayerMultiPlatform.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift b/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift index 6282e93..e747576 100644 --- a/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift +++ b/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift @@ -97,7 +97,13 @@ extension LoopPlayerMultiPlatform: UIViewRepresentable{ /// - context: The context for the view @MainActor func updateUIView(_ uiView: UIView, context: Context) { uiView.subviews.filter { $0 is ErrorView }.forEach { $0.removeFromSuperview() } - uiView.subviews.compactMap{ $0 as? LoopingPlayerProtocol }.forEach { $0.setCommand(command) } + uiView.subviews.compactMap{ $0 as? LoopingPlayerProtocol }.forEach { + if let asset = getAssetIfChanged(settings: settings, asset: $0.currentAsset){ + $0.update(asset: asset) + }else{ + $0.setCommand(command) + } + } updateView(uiView, error: error) }