Contents

playerViewController(_:timeToSeekAfterUserNavigatedFrom:to:)

Tells the delegate when the user skips, scrubs, or otherwise navigates to a new time and wants to resume playback at the target time.

Declaration

optional func playerViewController(_ playerViewController: AVPlayerViewController, timeToSeekAfterUserNavigatedFrom oldTime: CMTime, to targetTime: CMTime) -> CMTime

Parameters

  • playerViewController:

    The player view controller.

  • oldTime:

    The current playback time before the user began navigating.

  • targetTime:

    The time to which the user navigated.

Mentioned in

Return Value

The time at which to begin playback.

Discussion

The framework calls this method prior to beginning playback after a user-initiated scrubbing request. You can return a time value other than the specified target time if needed to enforce certain business rules. For instance, you may want to return a different time to prevent users from skipping past ad breaks in your program.

See Also

Responding to Navigation Events