@objc
public class PlayerConfiguration : NSObject, NSCopying, Codable
This is the structure that describes the player configuration for a single asset
ClearKey usage:
guard let url = URL(string: "STREAM-URL") else {
return
}
let playerConfiguration(with: url, contentType: .hls)
guard let player = PRESTOplaySDK.shared.playerForContent(playerConfiguration) else {
print("no player")
return
}
Fairplay usage:
guard let url = URL(string: "STREAM-URL") else {
return
}
let playerConfiguration(with: url, contentType: .hls)
playerConfiguration.drmSystem = .fairplay
playerConfiguration.drmConfiguration = DrmConfiguration()
playerConfiguration.drmConfiguration.environment = .production
playerConfiguration.drmConfiguration.userId = "..."
playerConfiguration.drmConfiguration.sessionId = "..."
playerConfiguration.drmConfiguration.merchant = "..."
playerConfiguration.drmConfiguration.assetId = "..."
playerConfiguration.drmConfiguration.variantId = "..."
guard let player = PRESTOplaySDK.shared.playerForContent(playerConfiguration) else {
print("no player")
return
}
Custom RequestModifier usage:
Example showing custom Fairplay URLs
guard let url = URL(string: "STREAM-URL") else {
return
}
let playerConfiguration(with: url, contentType: .hls)
playerConfiguration.drmSystem = .fairplay
playerConfiguration.drmConfiguration = DrmConfiguration()
playerConfiguration.drmConfiguration.licensingUrl = URL(string: "LICENSING-URL"
playerConfiguration.drmConfiguration.certificateUrl = URL(string: "CERTIFICATE-URL")
// implement custom request modifier to add headers and intercept
// the request
PRESTOplaySDK.shared.requestModifiers.append(RequestModifier())
PRESTOplaySDK.shared.responseModifiers.append(ResponseModifier())
guard let player = PRESTOplaySDK.shared.playerForContent(playerConfiguration) else {
print("no player")
return
}