Instance Property

automaticallyWaitsToMinimizeStalling

A Boolean value that indicates whether the player should automatically delay playback in order to minimize stalling.

Declaration

var automaticallyWaitsToMinimizeStalling: Bool { get set }

Discussion

When playing media delivered over HTTP, this property is used to determine if the player should automatically delay playback in order to minimize stalling. When this property is true and the player changes from a paused state (rate of 0.0) to a played state (rate > 0.0), the player will try to determine if the current item can play to its end at the currently specified rate. If it determines that it’s likely to encounter a stall, the value of the player’s timeControlStatus will change to waitingToPlayAtSpecifiedRate and playback will automatically start when the likelihood of stalling has been minimized. A similar condition will occur during playback if the current player item’s playback buffer is exhausted and playback stalls. Playback will automatically resume when the likelihood of stalling has been minimized.

You will need to set this property to false when you require precise control over playback start times, such as if you're are synchronizing multiple player instances using the setRate(_:time:atHostTime:) method. If the value of this property is false, playback will start immediately when requested as long as the playback buffer is not empty. If the playback buffer becomes empty and playback stalls, the player’s timeControlStatus will switch to paused and the playback rate will change to 0.0.

Changing the value of this property to false while the player’s timeControlStatus is waitingToPlayAtSpecifiedRate and its reasonForWaitingToPlay is toMinimizeStalls will cause the player to immediately attempt playback at the specified rate.

See Also

Managing Automatic Waiting Behavior

var reasonForWaitingToPlay: AVPlayer.WaitingReason?

The reason the player is currently waiting for playback to begin or resume.

var timeControlStatus: AVPlayerTimeControlStatus

A status that indicates whether playback is currently in progress, paused indefinitely, or suspended while waiting for appropriate network conditions.

func playImmediately(atRate: Float)

Plays plays the available media data immediately, at the specified rate.

struct AVPlayer.WaitingReason

The following are valid constant values for the player’s reasonForWaitingToPlay property.