Skip to main content
Version: 11.11.0

How to programmatically detect audio tracks on Android

This article describes how you can use the AudioTrack API, a sub-API of the MediaTrack API, to detect audio tracks. Implementing this functionality is a common use-case for developers who want to build their own UI to visualize the available audio languages.

Usage​

Listen for the ADDTRACK event on player.getAudioTracks() to detect every MediaTrack that is added to the player.

player.audioTracks.addEventListener(AudioTrackListEventTypes.ADDTRACK) { addTrackEvent ->
val audioTrack = addTrackEvent.track
}