# How to programmatically detect text tracks on iOS

This article describes how you can use the TextTrack API to detect text tracks, which can be subtitles, closed captions or metadata. Implementing this functionality is a common use-case for developers who want to build their own UI to visualize the available subtitle languages.

## Usage

Listen for the [`ADD_TRACK`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/ios/Structs/TextTrackListEventTypes) event on [`player.textTracks`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/ios/Classes/THEOplayer#/s:13THEOplayerSDK0A0C10textTracksAA13TextTrackList_pvp) to detect every [`TextTrack`](https://docs-preview.optiview.dolby.com/pr-860/theoplayer/v11/api-reference/ios/Protocols/TextTrack) that is added to the player.

```swift
self.player.textTracks.addEventListener(type: TextTrackListEventTypes.ADD_TRACK, listener: { addTrackEvent in
    let textTrack = addTrackEvent.track
})
```

## Related articles

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