Playing FairPlay streams with TVJS

Has anyone managed to play FairPlay streams using TVJS? According the MediaItem documentation three functions should be set as properties on the MediaItem for FairPlay streaming to work:

  • loadCertificate
  • loadAssetID
  • loadKey


In our case all three functions are set but loadKey is never called. Our first suspicion was that we are not calling the callback in loadCertificate correctly - we have tried both calling it with a base64-encoded certificate (that's how we receive it from our server) and a decoded version but the result is the same in both cases - loadAssetID is called but never loadKey and playback never starts.


Any more documentation or examples on how to play FairPlay streams using the TVJS Player would be greatly appreciated!


Edit: this is the error we get:


#T:[Main] #Error #SYSTEM : Error occurred: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" 
UserInfo={NSUnderlyingError=0x12fe76330 {Error Domain=NSOSStatusErrorDomain Code=-345003 "(null)"}, 
NSLocalizedFailureReason=An unknown error occurred (-345003), NSLocalizedDescription=The operation could not be completed}

Accepted Reply

Had the same issue. Base64 encoding both the certificate and the AssetID solved the problem.

Replies

HI, what is fpsMgr.assetIDFromURI(uri) doing? can you provide me with sample code?

I believe its just something like this:


var assetId = btoa(url.substr(url.indexOf("//") + 2));


Where btoa is the built-in function to base 64 encode the string.

As far as I know, fairplay is work well with fmp4. What I doubt is that if fairplay is work well with hevc ? It's well known that hevc has been support by hls through fmp4 since 2017 WWDC.