How to programmatically detect text tracks on Android
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 ADDTRACK
event on player.getTextTracks()
to detect every TextTrack that is added to the player.
player.textTracks.addEventListener(TextTrackListEventTypes.ADDTRACK) { addTrackEvent ->
val textTrack = addTrackEvent.track
}