---
title: "seek(to:completionHandler:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avplayeritem/seek(to:completionhandler:)-91gnw"
---

# seek(to:completionHandler:)

Sets the current playback time to the specified time.

## Declaration

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

```swift
nonisolated func seek(to time: CMTime) async -> Bool
```

## Parameters

- `time`: The time to which to seek.
- `completionHandler`: The block to invoke when the seek operation has either been completed or been interrupted. The block takes one argument:

## Discussion

Discussion Use this method to seek to a specified time in the player item and be notified when the operation completes. If the seek request completes without being interrupted (either by another seek request or by any other operation), the completion handler you provide is executed with the finished parameter set to true. If another seek request is already in progress when you call this method, the completion handler for the in-progress seek request is executed immediately with the finished parameter set to false.

## See Also

### Seeking through media

- [seek(to:toleranceBefore:toleranceAfter:completionHandler:)](avfoundation/avplayeritem/seek(to:tolerancebefore:toleranceafter:completionhandler:).md)
- [seek(to:completionHandler:)](avfoundation/avplayeritem/seek(to:completionhandler:)-1dibq.md)
- [cancelPendingSeeks()](avfoundation/avplayeritem/cancelpendingseeks().md)
