Subtitles

To show subtitles, you have two options:

  • Use an HLS stream with embedded subtitles.
  • Use an HLS stream as FPExternalMedia and configure the URL to subtitles.

Getting started

First, configure the player controls to use the subtitles plugin:

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

Then, you need to configure the player to use subtitles using one of the processes below.

HLS stream with embedded subtitles

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

Using FPExternalMedia with VTT files

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

Copy
Copied
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]
 )
info

Please note that subtitles only work with HLS streams. This includes when using FPExternalMedia.