# How to programmatically enable or disable audio tracks on iOS

This article describes how you can use the AudioTrack API, a sub-API of the MediaTrack API, to enable or disable audio tracks. Implementing this functionality is a common use-case for developers who want to build their own UI to toggle audio languages on and off.

Once you have programmatically selected a track, you can set its `enabled` property (or method) to `true` or `false`. Because only one audio track can play at a time, enabling an audio track automatically disables all other audio tracks. Note that this does not apply to text tracks: multiple text tracks can be active at the same time.

## Usage

The iOS SDK exposes the audio tracks through [`player.audioTracks`](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/v11/api-reference/ios/Classes/THEOplayer#/s:13THEOplayerSDK0A0C11audioTracksAA14AudioTrackList_pvp), which contains [`MediaTrack`](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/v11/api-reference/ios/Protocols/MediaTrack) objects with an `enabled` property.

```swift
// enable a specific audio track
self.player.audioTracks[indexOfRequestedAudioTrack].enabled = true
```

## Related articles

* [How to programmatically detect audio tracks](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/ios/media-tracks/detect-audio-tracks.md)
* [How to programmatically detect audio track changes](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/ios/media-tracks/detect-audio-track-changes.md)
* [How to build a chromeless UI](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/ios/ui/build-chromeless-ui.md)
