Skip to main content
Skip table of contents

Enabling playback of FPS encrypted content using OTVSSPLicenseDelegate

To enable FairPlay Streaming in your app using the OTVSSPLicenseDelegate:

  1. Create a new Xcode project and then instantiate the OTVSSPLicenseDelegate. This delegate needs to authenticate both the stream, the licence server and optionally the SSM server if you are using SSP Secure Session Management.
    The code below shows how you would instantiate the OTVSSPLicenseDelegate without SSM.

    APPLESCRIPT
    let licenseDelegate: OTVSSPLicenseDelegate?
    
    licenseDelegate = OTVSSPLicenseDelegate(certificateURL: sspCertificateURL, licenseURL: licenseURL)
  2. Instantiate an OTVDRMManager object in OPYFPSSDK to negotiate between OTVAVPlayer and your app (via the OTVSSPLicenseDelegate implementation).

    APPLESCRIPT
    private let drmManager = OTVDRMManager:shared
  3. Register the delegate to the OTVDRMManager:

    APPLESCRIPT
    drmManager.setLicenseDelegate(licenseDelegate)
  4. To enable the delegate to request a licence successfully, you need to set a media token. There are two options to do this: setStream() and setToken(). If your token is static for the playback session, use setStream(); however, if you need to update the media token for any subsequent licence request, use setToken() .

    • setStream() is the simplest way to set the token for the licence request. Use this method if you only intend to use one licence for the associated playback.
      For example, if Airplay is enabled, another licence request will take place and will use the original token (one passed into setStream()) to make that licence request.

      APPLESCRIPT
      licenseDelegate.setStream(token: sspToken, with: assetURL)
    •  setToken() triggers a callback whenever a subsequent licence request takes place for the associated playback item. One example is when enabling Airplay; it triggers a licence request and if you need a new media token for this licence request, using this callback is the only way this is possible. 

      CODE
      licenseDelegate?.setToken(initialToken: sspToken, tokenCallback: { () -> String in
              return self.sspToken
            })
  5. Instantiate an OTVAVPlayer using either the content URL or an OTVAVPlayerItem object and call its init() method:

    APPLESCRIPT
    private let player = OTVAVPlayer()
    player(item)
    
    
    /// or:
    
    private let player = OTVAVPlayer()
    player(url)

    You should now be able to use the OTVAVPlayer object to playback FPS-encrypted content in the same way as with AVPlayer.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.