Instance Method

playableContentManager(_:initiatePlaybackOfContentItemAt:completionHandler:)

Asks the delegate to begin playback of the specified content item.

Declaration

optional func playableContentManager(_ contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAt indexPath: IndexPath, completionHandler: @escaping (Error?) -> Void)

Parameters

contentManager

The content manager that initiated the request.

indexPath

The index for the indicated item.

completionHandler

A block to call after initiating a playback request.

The block takes the following parameter:

error

If you have successfully begun playback, pass nil. If you cannot begin media playback due to an error, pass an NSError object.

Discussion

iOS calls this method when a media player interface needs to play a media item. Your app responds by beginning playback of the requested media item. After beginning playback, call the provided completionHandler block with an argument of nil; or, if your app cannot begin playback, call the completion handler with an NSError object describing the error.