File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Sources/swiftui-loop-videoplayer Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ internal extension LoopingPlayerProtocol {
65
65
///
66
66
/// - Parameters:
67
67
/// - asset: The AVURLAsset to load into the player.
68
- func update( asset: AVURLAsset ) {
68
+ func update( asset: AVURLAsset , loop : Bool ) {
69
69
70
70
guard let player = player else { return }
71
71
@@ -83,6 +83,9 @@ internal extension LoopingPlayerProtocol {
83
83
// Replace the current item
84
84
let newItem = AVPlayerItem ( asset: asset)
85
85
player. insert ( newItem, after: nil )
86
+ if loop{
87
+ self . loop ( )
88
+ }
86
89
play ( )
87
90
}
88
91
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ extension LoopPlayerMultiPlatform: NSViewRepresentable{
155
155
let player = nsView. findFirstSubview ( ofType: PlayerView . self)
156
156
if let player {
157
157
if let asset = getAssetIfChanged ( for: settings, and: player. currentAsset) {
158
- player. update ( asset: asset)
158
+ player. update ( asset: asset, loop : settings . loop )
159
159
}
160
160
// Check if command changed before applying it
161
161
if context. coordinator. getLastCommand != command {
You can’t perform that action at this time.
0 commit comments