From 00ee73daad32acc3970a9dab8fd686c689980648 Mon Sep 17 00:00:00 2001 From: Sergey Chausov Date: Mon, 25 Apr 2022 10:53:39 +0300 Subject: [PATCH] FEC-10727 Add KS to external captions --- Sources/MediaOptions.swift | 8 ++++++++ Sources/OVP/KalturaOVPPlayer.swift | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Sources/MediaOptions.swift b/Sources/MediaOptions.swift index 0c5515d..2dd65fd 100644 --- a/Sources/MediaOptions.swift +++ b/Sources/MediaOptions.swift @@ -6,6 +6,7 @@ // import Foundation +import PlayKit @objc public class MediaOptions: NSObject { @@ -32,4 +33,11 @@ import Foundation return self } + @objc public var externalSubtitles: [PKExternalSubtitle]? + + @nonobjc public func set(externalSubtitles: [PKExternalSubtitle]) -> Self { + self.externalSubtitles = externalSubtitles + return self + } + } diff --git a/Sources/OVP/KalturaOVPPlayer.swift b/Sources/OVP/KalturaOVPPlayer.swift index bbd7178..6b79fc1 100644 --- a/Sources/OVP/KalturaOVPPlayer.swift +++ b/Sources/OVP/KalturaOVPPlayer.swift @@ -149,6 +149,14 @@ import PlayKitProviders return } + if let subtitles = options.externalSubtitles { + if mediaEntry.externalSubtitles != nil { + mediaEntry.externalSubtitles! += subtitles + } else { + mediaEntry.externalSubtitles = subtitles + } + } + self.setMediaAndUpdatePlugins(mediaEntry: mediaEntry, mediaOptions: options, pluginConfig: nil, callback: callback) } }