To show subtitles, you have two options:
- Use an HLS stream with embedded subtitles.
- Use an HLS stream as
FPExternalMediaand configure the URL to subtitles.
First, 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 using one of the processes below.
If your HLS stream contains subtitles, all you need to do is enable the subtitles plugin for the controls.
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]
)info
Please note that subtitles only work with HLS streams. This includes when using FPExternalMedia.