setSubtitleTrack method

Future<void> setSubtitleTrack(
  1. SubtitleTrack track
)

Sets the current SubtitleTrack for subtitle output.

  • Currently selected SubtitleTrack can be accessed using state.track.subtitle or stream.track.subtitle.
  • The list of currently available SubtitleTracks can be obtained accessed using state.tracks.subtitle or stream.tracks.subtitle.
  • External subtitle track can be loaded using SubtitleTrack.uri or SubtitleTrack.data constructor.
player.setSubtitleTrack(
  SubtitleTrack.uri(
    'https://www.iandevlin.com/html5test/webvtt/upc-video-subtitles-en.vtt',
    title: 'English',
    language: 'en',
  ),
);

Implementation

Future<void> setSubtitleTrack(SubtitleTrack track) async {
  return platform?.setSubtitleTrack(track);
}