From 55d1ae516f9fbf811cddc2fadfe0ee2b2b3cae1b Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 8 Aug 2024 11:22:46 +0200 Subject: [PATCH] Update LoopPlayerMultiPlatform.swift --- .../view/loop/main/LoopPlayerMultiPlatform.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift b/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift index e747576..6defed4 100644 --- a/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift +++ b/Sources/swiftui-loop-videoplayer/view/loop/main/LoopPlayerMultiPlatform.swift @@ -51,11 +51,11 @@ struct LoopPlayerMultiPlatform: LoopPlayerViewProtocol { /// Initializes a new instance with the provided settings and playback command. /// + /// This initializer sets up the necessary configuration and command bindings for playback functionality. + /// /// - Parameters: - /// - settings: An instance of `Settings` containing configuration details. + /// - settings: A binding to an instance of `VideoSettings` containing configuration details. /// - command: A binding to a `PlaybackCommand` that controls playback actions. - /// - /// This initializer sets up the necessary configuration and command bindings for playback functionality. init(settings: Binding, command: Binding) { self._settings = settings self._command = command @@ -149,6 +149,11 @@ extension LoopPlayerMultiPlatform: NSViewRepresentable{ } #endif +/// Checks if the asset has changed based on the provided settings and current asset. +/// - Parameters: +/// - settings: The current video settings, containing the asset's name and extension. +/// - asset: The current asset being played. +/// - Returns: A new `AVURLAsset` if the asset has changed, or `nil` if the asset remains the same. fileprivate func getAssetIfChanged(settings: VideoSettings, asset: AVURLAsset?) -> AVURLAsset?{ let a = assetForName(name: settings.name, ext: settings.ext)