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) } }