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

# estimatedSampleLocation()

Returns an estimate of the sample location indicated by the cursor.

```
optional func estimatedSampleLocation() throws -> MEEstimatedSampleLocation
```

## Return Value

An object that provides information about the estimated sample location.

## Discussion

Some formats may need to read some data on a per-sample basis to produce the exact sample location. For these formats, it’s more efficient to read a larger chunk of data that contains both the data to produce the exact sample location and the actual sample data.

> Note:
> If you implement this method, also implement ``doc://com.apple.mediaextension/documentation/MediaExtension/MESampleCursor/refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)``.

Pass the value this method returns to [`refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)`](/documentation/MediaExtension/MESampleCursor/refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)) to obtain the exact sample location.

To indicate that refinement isn’t necessary, return a value for [`refinementDataLocation`](/documentation/MediaExtension/MEEstimatedSampleLocation/refinementDataLocation) that has a zero length. If [`refinementDataLocation`](/documentation/MediaExtension/MEEstimatedSampleLocation/refinementDataLocation) has a non-zero length, the range for the estimated sample location needs to fully cover the refined range that [`refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)`](/documentation/MediaExtension/MESampleCursor/refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)) returns, and the refinement data location.

This method fails with the error [`MEError.Code.locationNotAvailable`](/documentation/MediaExtension/MEError-swift.struct/Code/locationNotAvailable) if the sample location indicated by the cursor isn’t contiguous or the method isn’t supported. In this case, use [`loadSampleBufferContainingSamples(to:completionHandler:)`](/documentation/MediaExtension/MESampleCursor/loadSampleBufferContainingSamples(to:completionHandler:)) to load the sample data.

---

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)