Skip to main content
Version: 11.8.0

How to programmatically detect text tracks on Roku

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

You can use the addedtexttrack event to programmatically detect all text tracks which are loaded with the stream.

sub Init()
...
m.THEOplayer.callFunc("addEventListener", "addedtexttrack", m.top, "onEventTextTracksChanged")
...
end sub

sub onEventTextTracksChanged()
textTracks = m.player.textTracks
print "Text tracks changed. "; textTracks
end sub