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

# tracks(withMediaType:)

Returns tracks that present media of a specified type.

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

## Parameters

`mediaType`

The media type according to which the asset filters its tracks. For valid values see [`AVMediaType`](/documentation/AVFoundation/AVMediaType).

## Return Value

An array of tracks of a specific media characteristic.

## Discussion

Apple discourages the use of this method in iOS 15, tvOS 15, and macOS 12 or later. Load tracks asynchronously using [`loadTracks(withMediaType:completionHandler:)`](/documentation/AVFoundation/AVFragmentedAsset/loadTracks(withMediaType:completionHandler:)) instead.

You may call this method without blocking the current thread after you’ve asynchronously loaded the [`tracks`](/documentation/AVFoundation/AVAsset/tracks) property.

---

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)