<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaExtension",
  "identifier" : "/documentation/MediaExtension/METrackReader/generateSampleCursor(atPresentationTimeStamp:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MediaExtension"
    ],
    "preciseIdentifier" : "c:objc(pl)METrackReader(im)generateSampleCursorAtPresentationTimeStamp:completionHandler:"
  },
  "title" : "generateSampleCursor(atPresentationTimeStamp:completionHandler:)"
}
-->

# generateSampleCursor(atPresentationTimeStamp:completionHandler:)

Provides a new sample cursor that points to the sample at or near the specified presentation timestamp.

```
func generateSampleCursor(atPresentationTimeStamp presentationTimeStamp: CMTime, completionHandler: @escaping @Sendable ((any MESampleCursor)?, (any Error)?) -> Void)
```

## Parameters

`presentationTimeStamp`

The presentation time stamp.

`completionHandler`

The completion block to execute when the generate operation finishes.

## Discussion

The new sample cursor points to the last sample with a presentation time stamp (PTS) less than or equal to `presentationTimeStamp`, or if there are no such samples, the first sample in PTS order.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)