Instance Method

preroll(atRate:completionHandler:)

Begins loading media data to prime the media pipelines for playback.

Declaration

func preroll(atRate rate: Float, completionHandler: ((Bool) -> Void)? = nil)

Parameters

rate

The playback rate to use when determining how much data to load.

completionHandler

A block to execute when the player finishes the load attempt. This block takes a single Boolean parameter that contains true if the data was loaded or false if there was a problem. For example, the value might be false if the preroll was interrupted by a time change or incompatible rate change.

Discussion

This method loads data starting at the item’s current playback time. The current rate for the playback item should always be 0 prior to calling this method. After the method calls the completion handler, you can change the item’s playback rate to begin playback.

If the player object is not ready to play (its status property is not readyToPlay), this method throws an exception.

See Also

Synchronizing Playback to an External Source

func setRate(Float, time: CMTime, atHostTime: CMTime)

Synchronizes the playback rate and time of the current item with an external source.

func cancelPendingPrerolls()

Cancels any pending preroll requests and invokes the corresponding completion handlers if present.

var masterClock: CMClock?

The master clock used for item timebases.