Skip to content

Commit ae76db8

Browse files
committed
update
1 parent a5effd8 commit ae76db8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Sources/swiftui-loop-videoplayer/protocol/player/LoopingPlayerProtocol.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ internal extension LoopingPlayerProtocol {
6565
///
6666
/// - Parameters:
6767
/// - asset: The AVURLAsset to load into the player.
68-
func update(asset: AVURLAsset){
68+
func update(asset: AVURLAsset, loop : Bool){
6969

7070
guard let player = player else { return }
7171

@@ -83,6 +83,9 @@ internal extension LoopingPlayerProtocol {
8383
// Replace the current item
8484
let newItem = AVPlayerItem(asset: asset)
8585
player.insert(newItem, after: nil)
86+
if loop{
87+
self.loop()
88+
}
8689
play()
8790
}
8891

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ extension LoopPlayerMultiPlatform: NSViewRepresentable{
155155
let player = nsView.findFirstSubview(ofType: PlayerView.self)
156156
if let player {
157157
if let asset = getAssetIfChanged(for: settings, and: player.currentAsset){
158-
player.update(asset: asset)
158+
player.update(asset: asset, loop: settings.loop)
159159
}
160160
// Check if command changed before applying it
161161
if context.coordinator.getLastCommand != command {

0 commit comments

Comments
 (0)