Skip to content

Subtitles & audio

The subtitle and audio menus fill themselves from the stream (embedded tracks) and from anything you sideload. Track objects and selection calls are identical on every platform.

player.load(
OGMediaItem.Builder(streamUrl)
.setSideloadedSubtitles(
listOf(
SubtitleSource("https://…/en.vtt", language = "en",
label = "English", isDefault = true),
SubtitleSource("https://…/de.vtt", language = "de", label = "Deutsch"),
),
)
.build(),
)

Positioned WebVTT cues (line: / position: / align: settings) render faithfully on all platforms.

textTracks / audioTracks expose everything with an isSelected flag; selectTextTrack(id) (or null/nil for off) and selectAudioTrack(id) switch. Audio entries carry language and channel count — surfaced as proper display names in the built-in menu.

subtitleStyle controls colors, background, edge type and the base size fraction; subtitleTextScale is a viewer-facing multiplier (the demos map it to Small / Default / Large / X-Large chips). Sizing follows the player height with sane clamps, matching TV-style caption behaviour.