Switch subtitle tracks
Learn how to detect, switch, and render subtitle tracks in the FastPix iOS Player.
The FastPix iOS Player SDK supports WebVTT-based subtitle tracks. It automatically parses the HLS manifest, fetches subtitle segments, and delivers cues in sync with playback. Your app is responsible for rendering the subtitle text in the UI.
Set up the subtitle track delegate
Set a preferred subtitle track
Set a preferred subtitle track by language name. The SDK automatically selects it when the video loads.
The preferred track is automatically applied on every playlist item change.
Get available subtitle tracks
Get the current subtitle track
Switch subtitle tracks
Disable subtitles
Render subtitle cues
The SDK delivers subtitle text in real time through the onSubtitleCueChange callback. Create a label to display the text:
Position the label above the seek bar inside playerViewController.view:
Handle subtitle events
Conform to FastPixSubtitleTrackDelegate to receive subtitle updates:
SubtitleTrack model
SubtitleRenderInfo model
Important:
- Subtitle rendering is the host app’s responsibility. The SDK delivers cue text only.
- Call
disableSubtitles()when switching playlist items to prevent stale cues from appearing on videos without subtitles.- Add the subtitle label to
playerViewController.view, notself.view, to ensure correct positioning across orientations and full-screen transitions.