Instance Method

prepareToPlay(completionHandler:)

Prepares a music player for playback.

Declaration

func prepareToPlay(completionHandler: @escaping (Error?) -> Void)

Parameters

completionHandler

A block that is called after the first item in the queue is buffered and ready to play.

error

If an error occurred, this parameter holds the error object that explains the error. Otherwise, the value of this parameter is nil.

Discussion

Call this function to ensure that the first item in the queue has been buffered and is ready to play. Code inside the completion handler is executed after the first item in the queue has been buffered.