<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVMutableComposition/tracks(withMediaType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMutableComposition(im)tracksWithMediaType:"
  },
  "title" : "tracks(withMediaType:)"
}
-->

# tracks(withMediaType:)

Returns tracks that contain media of a specified type.

```
func tracks(withMediaType mediaType: AVMediaType) -> [AVMutableCompositionTrack]
```

## Parameters

`mediaType`

The media type of the tracks to return.

## Return Value

An array of composition tracks, which is empty if there are no matching tracks.

## Discussion

Apple discourages using this method. Load tracks asynchronously using [`loadTracks(withMediaType:completionHandler:)`](/documentation/AVFoundation/AVMutableComposition/loadTracks(withMediaType:completionHandler:)) instead.

---

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)