---
title: "tracks(withMediaType:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avasset/tracks(withmediatype:)"
---

# tracks(withMediaType:)

Returns tracks that contain media of a specified type.

## Declaration

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

## Parameters

- `mediaType`: The media type of the tracks to return.

## Return Value

Return Value An array of tracks, which is empty if there are no tracks with the media type.

## Discussion

Discussion \You can call this method without blocking the current thread when the data in the tracks property is already loaded.
