Instance Method

playPrerollAd(completionHandler:)

Requests playback of a preroll video iAd.

Declaration

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

Parameters

completionHandler

Passing nil as the completion handler is an error and will throw an exception.

Discussion

If the player view controller's AVPlayer instance begins playing during a pre-roll ad, the video ad will stop immediately.

The completion handler's error argument will be non-nil if the pre-roll ad could not be played. Errors can occur for a number of reasons, such as lack of ad inventory, exceeding the maximum pre-roll ad playback frequency, iAd account configuration issues, and media playback issues. See ADError for an exhaustive list of possible errors.

See Also

Playing a Preroll Video Ad

class func preparePrerollAds()

Informs iAd that the application intends to play a preroll ad.

func cancelPreroll()

Cancels the playback of a preroll video ad.