I am trying to implement FairPlay in my application.
I am able to play an encrypted video using the SDK given by Apple but the problem is the SDK only supports iOS 11+ but my project supports iOS 9+. The Delegate methods used in the sample SDK are available from iOS 11+
So i have searched online and written the code but i am unable to play a video.
Here are the links in am using:
- Playlist: https://willzhanmswest.streaming.mediaservices.windows.net/92fc0471-0878-4eeb-80a3-e5b6fc497806/NoAudio.ism/manifest(format=m3u8-aapl)
- Certificate: https://openidconnectweb.azurewebsites.net/Content/FPSAC.cer
Here are the steps i have followed:
- Added a delegate to the AVURLAsset to call this delegate function shouldWaitForLoadingOfRequestedResource.
- In this function, i am first getting the contents of certificate in NSData
- Then, i am obtaining the asset string and converting it to NSData.
- Then, i am calling this function to create SPC value.
NSData *spc = [loadingRequest streamingContentKeyRequestDataForApp:certificate contentIdentifier:assetId options:nil error:nil];
- The SPC received and Asset ID is then passed to Azure server with application/x-www-form-urlencoded content-type.
- The CKC received is then trimmed to remove and tags and then converted it to Base64String and then called these functions
[dataRequest respondWithData:base64CkcData];
[loadingRequest finishLoading];
Can anyone help me find what am i doing wrong here?
Thanks.