Instance Method

playerViewController(_:willPresent:)

Tells the delegate the player view controller is about to begin playing a range of interstitial content.

Declaration

optional func playerViewController(_ playerViewController: AVPlayerViewController, willPresent interstitial: AVInterstitialTimeRange)

Parameters

playerViewController

The player view controller to which you’ve assigned the delegate.

interstitial

The time range of interstitial content that is about to begin.

Discussion

Interstitial content is material unrelated to the main content of a presentation that may have special playback options or requirements. For example, you can use this method to record when the user begins viewing an advertisement, or to enable the player view controller’s requiresLinearPlayback property to prevent skipping mandatory legal notices.

Use the interstitialTimeRanges property to identify time ranges for interstitial content in the AVPlayerItem object presented in the player view controller.

See Also

Responding to Interstitial Content Playback Events

func playerViewController(AVPlayerViewController, didPresent: AVInterstitialTimeRange)

Tells the delegate the player view controller has completed playing a range of interstitial content.