---
title: estimatedSampleLocation()
framework: MediaExtension
role: symbol
role_heading: Instance Method
platforms: [macOS 14.0+]
path: mediaextension/mesamplecursor/estimatedsamplelocation()
---

# estimatedSampleLocation()

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

## Declaration

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

## Return Value

Return Value An object that provides information about the estimated sample location.

## Discussion

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 refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:). Pass the value this method returns to refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:) to obtain the exact sample location. To indicate that refinement isn’t necessary, return a value for refinementDataLocation that has a zero length. If 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:) returns, and the refinement data location. This method fails with the error MEError.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:) to load the sample data.

## See Also

### Stepping through samples

- [samplesWithEarlierDTSsMayHaveLaterPTSs(than:)](mediaextension/mesamplecursor/sampleswithearlierdtssmayhavelaterptss(than:).md)
- [samplesWithLaterDTSsMayHaveEarlierPTSs(than:)](mediaextension/mesamplecursor/sampleswithlaterdtssmayhaveearlierptss(than:).md)
- [refineSampleLocation(_:refinementData:refinementDataLength:refinedLocation:)](mediaextension/mesamplecursor/refinesamplelocation(_:refinementdata:refinementdatalength:refinedlocation:).md)
- [stepByDecodeTime(_:completionHandler:)](mediaextension/mesamplecursor/stepbydecodetime(_:completionhandler:).md)
- [stepByPresentationTime(_:completionHandler:)](mediaextension/mesamplecursor/stepbypresentationtime(_:completionhandler:).md)
- [stepInDecodeOrder(by:completionHandler:)](mediaextension/mesamplecursor/stepindecodeorder(by:completionhandler:).md)
- [stepInPresentationOrder(by:completionHandler:)](mediaextension/mesamplecursor/stepinpresentationorder(by:completionhandler:).md)
