Subtitles

In order to show subtitles you have three options:

  • Use an HLS stream with embedded subtitles
  • Use an HLS stream as FPExternalMedia and configure the URL to subtitles
  • Upload the VTT files to Flowplayer Platform and use FPFlowplayerMedia

Getting started

First you need to configure the player controls to use the subtitles plugin:

let config = FPPlayerControlConfigBuilder()
        .setMuteControl(true)
        .enablePlugins(["subtitles"])
        .build()
flowplayerViewController.setControlConfig(config)

Then you need to configure the player to use subtitles.

HLS stream with embedded subtitles

If you HLS stream contains subtitles all you need to do is to enable the subtitles plugin for the controls.

Flowplayer Platform hosted video & subtitles

You can upload subtitles as VTT files for a video in the Flowplayer Platform UI from the "Files" view. The labels and languages configured will show up in the player.

Using FPExternalMedia with VTT files

If you are using FPExternalMedia, you can configure the subtitles by hand:

let track = FPTrack(
        lang: "en",
        src: "https://mycdn.example.com/subs.vtt",
        label: "English subs",
        kind: ""
)

let externalMedia = FPExternalMedia(
        mediaUrl: "https://mycdn.example.com/video.m3u8",
        adSchedule: nil,
        metadata: nil,
        subtitles: [track]
 )

Please note that subtitles only work with HLS streams, also when using FPExternalMedia.

Results