Skip to content

Commit

Permalink
Merge pull request #257 from w43322/w43322-patch-1
Browse files Browse the repository at this point in the history
Fix bufferSizeInSeconds Not Affecting preferredForwardBufferDuration
  • Loading branch information
piemonte authored Dec 13, 2024
2 parents 4035177 + ce1adab commit 59fa302
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/Player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ open class Player: UIViewController {
}

/// Playback buffering size in seconds.
open var bufferSizeInSeconds: Double = 10
open var bufferSizeInSeconds: Double = 10 {
didSet {
self._playerItem?.preferredForwardBufferDuration = self.bufferSizeInSeconds
}
}

/// Playback is not automatically triggered from state changes when true.
open var playbackEdgeTriggered: Bool = true
Expand Down Expand Up @@ -685,6 +689,8 @@ extension Player {
self._playerItem?.preferredMaximumResolution = self._preferredMaximumResolution
}

self._playerItem?.preferredForwardBufferDuration = self.bufferSizeInSeconds

if let seek = self._seekTimeRequested, self._playerItem != nil {
self._seekTimeRequested = nil
self.seek(to: seek)
Expand Down

0 comments on commit 59fa302

Please sign in to comment.