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

# tracks(withMediaType:)

Returns tracks that contain media of a specified type.

## Declaration

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

## Parameters

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

## Return Value

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

## Discussion

Discussion Apple discourages using this method. Load tracks asynchronously using loadTracks(withMediaType:completionHandler:) instead.

## See Also

### Accessing tracks

- [tracks](avfoundation/avmutablecomposition/tracks.md)
- [track(withTrackID:)](avfoundation/avmutablecomposition/track(withtrackid:).md)
- [tracks(withMediaCharacteristic:)](avfoundation/avmutablecomposition/tracks(withmediacharacteristic:).md)
