Skip to navigation

Show subtitles

The FastPix Flutter Player detects subtitle tracks from the video’s HLS manifest and shows them during playback, with a selector so viewers can switch between the available languages. You do not configure the tracks in your app.


How subtitles work

  • The player reads the subtitle tracks from the manifest when the video loads.
  • It lists the available tracks in the player’s controls, so a viewer can turn subtitles on and choose a language.
  • Viewers can switch between subtitle tracks during playback.

Because the tracks come from the manifest, the video needs subtitle or caption tracks for any of this to appear. A video with no subtitle tracks shows no subtitle option.


Show subtitles by default

Set showSubtitles to true on the data source to display subtitles as soon as playback starts, instead of waiting for the viewer to turn them on.

import 'package:fastpix_video_player/fastpix_video_player.dart';
final dataSource = FastPixPlayerDataSource.hls(
playbackId: 'your-playback-id',
showSubtitles: true, // Show subtitles from the start
);

When showSubtitles is omitted, subtitles stay off until the viewer selects a track.


Frequently asked questions

Do I need to add the subtitle tracks in code?

No. The player reads them from the HLS manifest automatically. Make sure the video was created with subtitle or caption tracks, and they appear in the player on their own.

Can viewers switch subtitle languages during playback?

Yes. The player lists every subtitle track from the manifest in its controls, and a viewer can switch between them while the video plays.

Why are no subtitles showing?

The video has no subtitle tracks in its manifest, or showSubtitles is off and the viewer has not turned subtitles on. Confirm the video was uploaded with captions, then set showSubtitles: true to show them by default.


Switch subtitle and audio tracks in code

To list and switch tracks yourself, rather than through the built-in controls, use the controller’s track API (getSubtitleTracks, setSubtitleTrack, disableSubtitles, getAudioTracks, setAudioTrack). See Build a custom UI for the full track and quality API.


What’s next