prepareToPlay(completionHandler:)
Prepares a music player for playback.
Declaration
func prepareToPlay(completionHandler: @escaping @Sendable ((any Error)?) -> Void)func prepareToPlay() async throwsParameters
- completionHandler:
A block that the system call after it buffers the first item in the queue and it’s 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 227m0.
Discussion
Call this function to ensure that the system buffers the first item in the queue and it’s ready to play. The system executes the code in the completion handler after it buffers the first item in the queue.