# Subtitle
ByteArk Player SDK for Android supports subtitles embedded in the HLS/DASH manifest, with customizable appearance, and a viewer-facing picker through the player UI.
# Style subtitle appearance
val playerBuilder = ByteArkPlayerBuilder.Builder()
.withContext(this)
.withSubtitleSize(SubtitleSize.MEDIUM)
.withSubtitleBackgroundEnabled(true)
.withSubtitlePaddingBottomPercentage(10)
.build()
1
2
3
4
5
6
2
3
4
5
6
| Builder method | Type | Description |
|---|---|---|
withSubtitleSize(size: SubtitleSize) | enum | Font size (SMALL, MEDIUM, LARGE) |
withSubtitleBackgroundEnabled(enabled: Boolean) | Boolean | Show subtitle background |
withSubtitlePaddingBottomPercentage(percentage: Int) | Int | Bottom padding (%) |
# Select subtitle via API
val subtitles: List<ByteArkSubtitle> = mPlayerFragment.getSubtitles()
val current: ByteArkSubtitle? = mPlayerFragment.getCurrentSubtitle()
mPlayerFragment.setSubtitle(subtitles[0])
1
2
3
4
2
3
4
# Receive subtitle cue events
override fun onCues(cues: List<Cue>) {
// Use for custom subtitle rendering if needed
}
1
2
3
2
3