Contents

seek(to:toleranceBefore:toleranceAfter:completionHandler:)

Sets the current playback time within a specified time bound and invokes the specified block when the seek operation completes or is interrupted.

Declaration

nonisolated func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: (@Sendable (Bool) -> Void)? = nil)
nonisolated func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool

Parameters

  • time:

    The time to which to seek.

  • toleranceBefore:

    The temporal tolerance before time.

    Pass Zero to request sample accurate seeking (this may incur additional decoding delay).

  • toleranceAfter:

    The temporal tolerance after time.

    Pass Zero to request sample accurate seeking (this may incur additional decoding delay).

  • completionHandler:

    The block to invoke when the seek operation has finished.

Discussion

Use this method to seek to a specified time for the item.

The time seeked to will be within the range [time-toleranceBefore, time+toleranceAfter] and may differ from time for efficiency.

Invoking this method with positiveInfinity for toleranceBefore and toleranceAfter is the same as invoking seek(to:completionHandler:) directly.

Seeking is constrained by the collection of seekable time ranges. If you seek to a time outside all of the seekable ranges, the seek will result in a current time within the seekable ranges.

See Also

Seeking through media