public class PRESTOplaySDK
Main interface for initializing the SDK and additional plugins.
public class PRESTOplaySDK
Main interface for initializing the SDK and additional plugins.
Returns the globally shared SDK instance.
Swift
public static let shared: PRESTOplaySDK
NetworkConfiguration (if set) is applied to NetworkEngine
Swift
public var networkConfiguration: NetworkConfiguration?
When enabled, uses the redirect-resolved manifest URL as the base for segment downloads.
Default is false to preserve legacy behavior.
Swift
public var useRedirectedManifestURLForDownloads: Bool
State timeout in seconds
Throws .network_error with timeout message if the Player
remains in .playing state for longer than this value without
positive effective playback rate.
The feature is enabled if value is greater than 0.0.
Swift
public var stateTimeout: Double
Report most recent error / warning
Swift
public var onError: ErrorHandler?
Returns the authentication key for the device. Client is responsible for implementing this method.
Swift
public var onDeviceAuthTokenRequired: AuthTokenHandler?
Returns the authentication key for AirPlay. Client is responsible for implementing this method.
Swift
public var onAirplayAuthTokenRequired: AuthTokenHandler?
Initialises the SDK. This method should be called before any other.
Only the first call to this method is honoured. Subsequent calls are no-ops.
Swift
@available(*, deprecated, message: "Will be removed in 4.1.0, use `setup(﹚` instead.")
public func register(
_ license: String,
_ plugins: [CLPluginProtocol],
_ companion: CompanionSDK? = nil
) -> LicenseCheck
license
|
License description. |
plugins
|
Array of plugin to be enabled. |
companion
|
Companion SDK metadata. |
InItialization result.
Initialises the SDK. This method should be called before any other.
Only the first call to this method is honoured. Subsequent calls are no-ops.
Swift
public func setup(
_ license: String,
_ plugins: [CLPluginProtocol],
_ companion: CompanionSDK? = nil
) -> PRESTOerror?
license
|
License description. |
plugins
|
Array of plugin to be enabled. |
companion
|
Companion SDK metadata. |
InItialization error, or nil if succeed.
Sets the logging verbosity.
Swift
public func setLogLevel(_ level: CLLogLevel)
level
|
Log level. |
Creates player without configuration.
Configuration can be loaded later with load method.
Swift
public func player() -> PlayerAPI
Common player interface.
Creates player for given configuration.
Swift
public func player(for config: PlayerConfiguration) -> PlayerAPI?
config
|
Player configuration. |
Player instance.
Creates a PlayerViewControllerAPI instance with the channel items and analytics data.
Swift
@available(tvOS 15.0, *)
public func playerViewController(
channels: [ChannelItem],
analytics: [AnalyticsBackend?: AnalyticsMetadata]?,
loopChannels: Bool
)
-> PlayerViewControllerAPI?
channels
|
Array of channel items to be played. |
analytics
|
AnalyticsBackend instance and the necessary metadata for analytics. |
loopChannels
|
Loop the channel list at the first or last channel. |
An optional PlayerViewControllerAPI instance.
Creates DRM Prefetcher for given configuration.
Swift
public func prefetcher(for config: PlayerConfiguration) -> CLDrmPrefetcherAPI?
config
|
Player configuration. |
DRM prefetcher instance.
Creates downloader without configuration.
Configuration can be loaded later with createDownload method.
Swift
public func downloader() -> DownloaderAPI
Common downloader interface.
Sets the default playback rate range.
Swift
public func setPlaybackRateRange(of playerEngine: PlayerEngine, to range: ClosedRange<Double>)
playerEngine
|
Type of player engine. |
range
|
Playback rate range. |
Retrieves the playback rate range for the player engine type.
Swift
public func getPlaybackRateRange(of playerEngine: PlayerEngine?) -> ClosedRange<Double>?
playerEngine
|
Type of player engine. |
Playback rate range.
Initialises cast with cast settings.
At this point authorisation requests are triggered if required.
Swift
public func cast(
for castSettings: CastSettings
) -> CastAPI?
castSettings
|
Cast settings. |
Instance of cast.
Returns the cast client for a given session with player instance.
Swift
public func cast(
forSession sessionId: String,
engine castEngine: CastEngine? = CastEngine(rawValue: 0)
) -> CastAPI?
sessionId
|
Current session with player instance. |
castEngine
|
Cast engine. |
Cast client.
Returns the cast client for a given player.
Swift
public func cast(
for player: PlayerAPI,
engine castEngine: CastEngine? = CastEngine(rawValue: 0)
) -> CastAPI?
player
|
Current player instance. |
castEngine
|
Cast engine. |
Cast client.
Returns the Advertisements client.
Swift
public func ads(
forSession sessionId: String,
settings adsSettings: AdsSettings? = nil
) -> AdsAPI?
sessionId
|
Current session id with player instance. |
adsSettings
|
Ad configuration. If nil, default configuration will be used |
Advertisment instance.
Returns the Advertisements client.
Swift
public func ads(
for player: PlayerAPI,
settings adsSettings: AdsSettings? = nil
) -> AdsAPI?
player
|
Current player instance. |
adsSettings
|
Ad configuration. If nil, default configuration will be used |
Advertisment instance.
Creates an Analytics client for a given session with player and analytics backend.
Swift
public func analytics(
forSession sessionId: String,
_ backend: AnalyticsBackend? = nil
) -> AnalyticsAPI?
sessionId
|
Session identifier with existing player instance. |
backend
|
Analytics backend. |
Creates an Analytics client for a given player and analytics backend.
Swift
public func analytics(
for player: PlayerAPI,
_ backend: AnalyticsBackend? = nil
)
-> AnalyticsAPI?
player
|
Player instance. |
backend
|
Analytics backend. |
Returns the Subtitles client for a given session with player instance.
Swift
public func subtitles(
forSession sessionId: String,
callbacksQueue: DispatchQueue? = nil
) -> SubtitlesAPI?
sessionId
|
Current session with the player instance. |
Subtitles client.
Returns the Subtitles client for a given player.
Swift
public func subtitles(
for player: PlayerAPI,
callbacksQueue: DispatchQueue? = nil
) -> SubtitlesAPI?
player
|
Current player instance. |
Subtitles client.
Returns the Thumbnails client for a given session with player instance.
Swift
public func thumbnails(
forSession sessionId: String,
engine thumbnailsEngine: ThumbnailsEngine = .castlabs
) -> ThumbnailsAPI?
sessionId
|
Session Id with player instance. |
Thumbnails client.
Returns the Thumbnails client for a given player.
Swift
public func thumbnails(
for player: PlayerAPI,
engine thumbnailsEngine: ThumbnailsEngine = .castlabs
) -> ThumbnailsAPI?
player
|
Current player instance. |
Thumbnails client.
Returns the playlist api client.
Swift
public func playlist(
forSession sessionId: String,
mode: PlaylistMode = .playerRecreate,
loopList: Bool? = true
) -> PlaylistAPI?
sessionId
|
Session Id with player instance.. |
mode
|
Playlist mode. |
loopList
|
Loops the playlist. Default is true. False value is effective only in
|
Playlist manager instance.
Returns the playlist api client.
Swift
public func playlist(
for player: PlayerAPI,
mode: PlaylistMode = .playerRecreate,
loopList: Bool? = true
) -> PlaylistAPI?
player
|
Current player instance. |
mode
|
Playlist mode. |
loopList
|
Loops the playlist. Default is true. False value is effective only in
|
Playlist manager instance.