---
title: "track(withTrackID:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avfragmentedasset/track(withtrackid:)"
---

# track(withTrackID:)

Returns a track that contains the specified identifier.

## Declaration

```swift
func track(withTrackID trackID: CMPersistentTrackID) -> AVFragmentedAssetTrack?
```

## Parameters

- `trackID`: The identifier of the track to return.

## Return Value

Return Value A fragmented asset track, or nil if no track with the specified identifier is available.

## Discussion

Discussion Apple discourages the use of this method in iOS 15, tvOS 15, and macOS 12 or later. Load a track asynchronously using loadTrack(withTrackID:completionHandler:) instead. You may call this method without blocking the current thread after you’ve asynchronously loaded the tracks property.

## See Also

### Accessing tracks

- [tracks](avfoundation/avfragmentedasset/tracks.md)
- [tracks(withMediaType:)](avfoundation/avfragmentedasset/tracks(withmediatype:).md)
- [tracks(withMediaCharacteristic:)](avfoundation/avfragmentedasset/tracks(withmediacharacteristic:).md)
