---
title: "samplePresentationTime(forTrackTime:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avassettrack/samplepresentationtime(fortracktime:)"
---

# samplePresentationTime(forTrackTime:)

Maps the specified track time through the appropriate time mapping and returns the resulting sample presentation time.

## Declaration

```swift
func samplePresentationTime(forTrackTime trackTime: CMTime) -> CMTime
```

## Parameters

- `trackTime`: The track time for which to request the sample presentation time.

## Return Value

Return Value The sample presentation time corresponding to the specified time; otherwise invalid if the time is out of range.

## Discussion

Discussion Apple discourages using this method in iOS 15, tvOS 15, macOS 12, and watchOS 8 or later. Load a sample presentation time asynchronously using loadSamplePresentationTime(forTrackTime:completionHandler:) instead.
