Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/config automatically waits to minimize stalling #199

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Example/PlayerConfigurationExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions Sources/Core/Components/ModernAVPlayerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Core/Components/PlayerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
2 changes: 1 addition & 1 deletion Sources/Core/State/InitState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct InitState: PlayerState {
}

func contextUpdated() {
context.player.automaticallyWaitsToMinimizeStalling = false
context.player.automaticallyWaitsToMinimizeStalling = context.config.automaticallyWaitsToMinimizeStalling
}

// MARK: - Shared actions
Expand Down