# How to programmatically detect video track quality changes on Android

This article describes how you can use the VideoTrack API, a sub-API of the MediaTrack API, to detect video track quality changes. Implementing this functionality is a common use-case for developers who want to build their own UI to visualize the video track quality that is currently active.

## Usage

Listen for the [`ACTIVEQUALITYCHANGEDEVENT`](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/v11/api-reference/android/com/theoplayer/android/api/event/track/mediatrack/video/VideoTrackEventTypes#ACTIVEQUALITYCHANGEDEVENT) event of a [`MediaTrack`](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/v11/api-reference/android/com/theoplayer/android/api/player/track/mediatrack/MediaTrack).

```kotlin
// detect video tracks being added to the player
player.videoTracks.addEventListener(VideoTrackListEventTypes.ADDTRACK) { addTrackEvent ->
    // detect quality changes of a track
    addTrackEvent.track.addEventListener(VideoTrackEventTypes.ACTIVEQUALITYCHANGEDEVENT) { event ->
        println("activequalitychanged event detected! ${event.quality}")
    }
}
```

## Related articles

* [How to programmatically detect video track qualities](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/android/media-tracks/detect-video-track-qualities.md)
* [How to programmatically select a video track quality](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/android/media-tracks/select-video-track-quality.md)
* [How to programmatically detect audio track changes](https://docs-preview.optiview.dolby.com/pr-861/theoplayer/how-to-guides/android/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/android/ui/build-chromeless-ui.md)
