Skip to main content
Skip table of contents

SRT subtitle tracks

The CONNECT Player SDK supports external SRT subtitle tracks in a stream.

Prerequisites

An external SRT subtitle track URL to be downloaded and used.

Example code

After basic playback and track selection has been set up, you can add an external SRT track. The SRT track should be called before playback starts to be populated at the beginning of playback. However, if the track is not unique, it will not be added to the tracks list; for example, a track with the same language is already present.

To do this, you need an SRT url and call the method on OTVAVPlayer, addSubtitleWithUrl(subtitleURL: String, mimeType: String, language: String).

  • Parameter subtitleURL: The URL of the subtitle.

  • Parameter mimeType: The mimeType of the subtitle, for SRT this should be application/x-subrip.

  • Parameter language: The language of the subtitle, for example, English.

CODE
_ = otvPlayer.addSubtitleWithUrl(subtitleURL: "URLOfSubtitle", mimeType: "application/x-subrip", language: "English")

As long as you conform to OTVTracksChangedListener as described in the Track selection feature, the delegate method tracksChanged() will be triggered when the tracks are downloaded and parsed by OTVAVPlayer.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.