FairplayConfig

@objcMembers
@objc(BMPFairplayConfig)
public class FairplayConfig : DrmConfig

Represents a FairPlay Streaming DRM config.

  • The URL to the FairPlay Streaming certificate of the license server.

    Declaration

    Swift

    public var certificateUrl: URL?
  • A dictionary to specify custom HTTP headers for the license request.

    Declaration

    Swift

    public var licenseRequestHeaders: [String : String]?
  • A dictionary to specify custom HTTP headers for the certificate request.

    Declaration

    Swift

    public var certificateRequestHeaders: [String : String]?
  • A block to prepare the data which is sent as the body of the POST license request. As many DRM providers expect different, vendor-specific messages, this can be done using this user-defined block.

    Declaration

    Swift

    public var prepareMessage: ((_ spcData: Data, _ assetID: String) -> Data)?
  • A block to prepare the contentId, which is sent to the FairPlay Streaming license server as request body, and which is used to build the SPC data. As many DRM providers expect different, vendor-specific messages, this can be done using this user-defined block. The parameter is the skd:// URI extracted from the HLS manifest (m3u8) and the return value should be the contentID as string.

    Declaration

    Swift

    public var prepareContentId: ((_ contentId: String) -> String)?
  • A block to prepare the loaded certificate before building SPC data and passing it into the system. This is needed if the server responds with anything else than the certificate, e.g. if the certificate is wrapped into a JSON object. The server response for the certificate request is passed as parameter “as is”.

    Declaration

    Swift

    public var prepareCertificate: ((_ certificate: Data) -> Data)?
  • A block to prepare the loaded CKC Data before passing it to the system. This is needed if the server responds with anything else than the license, e.g. if the license is wrapped into a JSON object.

    Declaration

    Swift

    public var prepareLicense: ((_ ckc: Data) -> Data)?
  • A block to prepare the URI (without the skd://) from the HLS manifest before passing it to the system.

    Declaration

    Swift

    public var prepareLicenseServerUrl: ((_ licenseServerUrl: String) -> String)?
  • A block to prepare the loaded CKC data received by the Sync SPC call to the respective Key Security Module (KSM). This data may contain information about the expiration dates of a DRM license.

    Declaration

    Swift

    public var prepareOfflineDrmLicenseInformation: ((_ data: Data) -> DrmLicenseInformation)?
  • A block to prepare the data which is sent as the body of the POST request for syncing the DRM license information.

    Declaration

    Swift

    public var prepareSyncMessage: ((_ syncSpcData: Data, _ assetID: String) -> Data)?
  • A block to provide the license for the given assetId.

    This should only be used when the license is stored locally. If the block returns nil we will try to fetch the license using the available information in the same FairplayConfig instance. If no certificateUrl is present at this point we will emit a SourceErrorEvent.

    Use this block for the following use-cases:

    • License caching during playback or for future playback sessions.
    • Providing the license for an already locally available content which can be provided using the SourceType.movpkg

    Important

    In both use-cases, it’s required that the license is persistable on the device. Playback will fail otherwise.

    If the provided license is expired playback will fail. License duration handling has to be handled by the application.

    Declaration

    Swift

    @available(tvOS, unavailable)
    public var provideLicenseData: ((_ assetId: String) -> Data?)? { get set }
  • A block to enable custom persisting of license data for the given assetId.

    Use this block for the following use-cases:

    • To store the license data locally for future playback sessions.
    • To update the license during a playback session if the license requires updating.

    Important

    In both use-cases, it’s required that the license is persistable on the device. Playback will fail otherwise.

    Declaration

    Swift

    @available(tvOS, unavailable)
    public var persistLicenseData: ((_ assetId: String, _ licenseData: Data) -> Void)? { get set }
  • Creates a new FairPlay Streaming config based on the given license URL and certificate URL.

    Declaration

    Swift

    @objc(initWithLicenseUrl:certificateURL:)
    public init(license licenseUrl: URL?, certificateURL: URL)

    Parameters

    licenseUrl

    The URL to the license server.

    certificateURL

    The URL to the FairPlay Streaming certificate of the license server.

    Return Value

    A new FairPlay Streaming config initialized with the given licenseURL and certificateURL.

  • Creates a new FairPlay Streaming config based on the given certificate URL.

    Declaration

    Swift

    public convenience init(certificateURL certificateUrl: URL)

    Parameters

    certificateUrl

    The URL to the FairPlay Streaming certificate of the license server.

    Return Value

    A new FairPlay Streaming config initialized with the given certificateURL. The license URL defaults to nil.

  • Creates a new FairPlay Streaming config based on the given provideLicenseData callback.

    Important

    It’s required that the license is persistable on the device. Playback will fail otherwise.

    Declaration

    Swift

    @available(tvOS, unavailable)
    public init(provideLicenseDataCallback: @escaping (_ assetId: String) -> Data?)

    Parameters

    provideLicenseDataCallback

    A block to provide the license for the given assetId.

    Return Value

    A new FairPlay Streaming config initialized with the given provideLicenseData callback. The license and certificate URL are defaulting to nil.