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

# track(withTrackID:)

Retrieves a track in the movie that contains the specified identifier.

## Declaration

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

## Parameters

- `trackID`: The persistent track identifier.

## Return Value

Return Value A movie track, or nil if there is no track with the identifier.

## Discussion

Discussion Apple discourages using this method in iOS 15, tvOS 15, macOS 12, and watchOS 8 or later. Load a track asynchronously using loadTrack(withTrackID:completionHandler:) instead.

## See Also

### Accessing tracks

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