Fairplay doesn't work

We are implementing fairplay with our video player, and we can do all the steps Apple requires to play drm video, but the video just doesn't play. We can:

  • Receive a call from our delegate: shouldWaitForLoadingOfRequestedResource
  • In the above call, we load the certificate correctly and with certificate + assetId, we successfully generate the SPC
  • With SPC we can POST for server licensing and get enough CKC
  • With CKC we call

    loadingRequest.dataRequest?.respond(with: ckcResponseData)  
    loadingRequest.finishLoading()
    
          

But the video just doesn't start playing. Is there something we are missing? Do we need an "FPS Deployment Package" in order for it to work with our Apple account? Please note that we are already testing real devices.

+3


source to share


1 answer


It's hard to tell without seeing your implementation. Anyway, here I can share my experience with FairPlay. I am assuming that your game CAN play without encrypted videos, so it is well implemented and works.

If you've successfully gotten to the "finishLoading" part on the other hand (and before all of this happens), you need to register as an observer for "currentItem.status" on the player. Something like:

player.addObserver(self, forKeyPath: "currentItem.status", options: NSKeyValueObservingOptions.new, context: nil);

      

So, at some point, you will get the observValueForKeyPath callback and you will need to check what is going on:



override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    // Do any other KVO-related checks... and the following:
    if let status = self.player.currentItem?.status {
        switch (status) {
        case .failed:
            // Something went wrong!
            self.itemFailed()
        case .readyToPlay:
            // Item is ready to play, so just .play() it!
            self.itemReadyToPlay()
        case .unknown:
            // Oh-oh.
            self.itemUnknown()
        }
    }
}

      

Let me know if you are already at this stage what errors you are getting.

(what is not about FairPlay here, but more general about loading assets, it does not violate any EULA)

0


source







All Articles