diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aa79e4e..8e830d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ## [X.X.X] * Feature: * Accept optional avaudio session catergory option + * provide a way to set player.automaticallyWaitsToMinimizeStalling through configuration * Dependencies: * [gem] Cocoapods -> 1.10.1 * [gem] Fastlane -> 2.171.0 diff --git a/Example/PlayerConfigurationExample.swift b/Example/PlayerConfigurationExample.swift index 19cee1c1..aec44807 100644 --- a/Example/PlayerConfigurationExample.swift +++ b/Example/PlayerConfigurationExample.swift @@ -39,6 +39,8 @@ struct PlayerConfigurationExample: PlayerConfiguration { // AVPlayerItem Init Service let itemLoadedAssetKeys = ["playable", "duration"] + + let automaticallyWaitsToMinimizeStalling = false init() { periodicPlayingTime = CMTime(seconds: 0.1, preferredTimescale: preferredTimescale) diff --git a/Sources/Core/Components/ModernAVPlayerConfiguration.swift b/Sources/Core/Components/ModernAVPlayerConfiguration.swift index a39c84b9..d2d5746a 100644 --- a/Sources/Core/Components/ModernAVPlayerConfiguration.swift +++ b/Sources/Core/Components/ModernAVPlayerConfiguration.swift @@ -54,6 +54,8 @@ public struct ModernAVPlayerConfiguration: PlayerConfiguration { public let allowsExternalPlayback = false public let itemLoadedAssetKeys = ["playable", "duration"] + + public let automaticallyWaitsToMinimizeStalling = false public init() { periodicPlayingTime = CMTime(seconds: 1, preferredTimescale: preferredTimescale) diff --git a/Sources/Core/Components/PlayerConfiguration.swift b/Sources/Core/Components/PlayerConfiguration.swift index c7e6512e..1ad3eb8b 100644 --- a/Sources/Core/Components/PlayerConfiguration.swift +++ b/Sources/Core/Components/PlayerConfiguration.swift @@ -63,4 +63,7 @@ public protocol PlayerConfiguration { /// Use to feed `automaticallyLoadedAssetKeys` on `AVPlayerItem` initialization var itemLoadedAssetKeys: [String] { get } + + /// Use to feed `automaticallyWaitsToMinimizeStalling` for `AVPlayer` + var automaticallyWaitsToMinimizeStalling: Bool { get } } diff --git a/Sources/Core/State/InitState.swift b/Sources/Core/State/InitState.swift index 2230957a..ffe0c51b 100644 --- a/Sources/Core/State/InitState.swift +++ b/Sources/Core/State/InitState.swift @@ -44,7 +44,7 @@ struct InitState: PlayerState { } func contextUpdated() { - context.player.automaticallyWaitsToMinimizeStalling = false + context.player.automaticallyWaitsToMinimizeStalling = context.config.automaticallyWaitsToMinimizeStalling } // MARK: - Shared actions