Contents

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  @Sendable ((any Error)?) -> Void)
optional func playableContentManager(_ contentManager: MPPlayableContentManager, initiatePlaybackOfContentItemAt indexPath: IndexPath) async throws

Parameters

  • contentManager:

    The content manager that initiated the request.

  • indexPath:

    The index for the indicated item.

  • completionHandler:

    A block that the system calls after initiating a playback request. The block takes the following parameter:

    error

    Pass Nil 227m0 if playback successfully began. If playback can’t begin, pass an error to indicate the reason.

Discussion

The system 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 can’t begin playback, call the completion handler with an error that indicates the reason.