Skip to content

Commit 080ee32

Browse files
committed
Update LoopPlayerMultiPlatform.swift
1 parent 8017361 commit 080ee32

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ extension LoopPlayerMultiPlatform: UIViewRepresentable{
9797
/// - context: The context for the view
9898
@MainActor func updateUIView(_ uiView: UIView, context: Context) {
9999
uiView.subviews.filter { $0 is ErrorView }.forEach { $0.removeFromSuperview() }
100-
uiView.subviews.compactMap{ $0 as? LoopingPlayerProtocol }.forEach { $0.setCommand(command) }
100+
uiView.subviews.compactMap{ $0 as? LoopingPlayerProtocol }.forEach {
101+
if let asset = getAssetIfChanged(settings: settings, asset: $0.currentAsset){
102+
$0.update(asset: asset)
103+
}else{
104+
$0.setCommand(command)
105+
}
106+
}
101107

102108
updateView(uiView, error: error)
103109
}

0 commit comments

Comments
 (0)