Enabling playback of FPS encrypted content
To enable FairPlay Streaming in your app:
Create a new Xcode project and then implement the
OTVLicenseDelegateprotocol to provide the FPS-specific information that the player needs. This delegate needs to authenticate both the stream and the license server.CODEfinal class OTVDelegate: NSObject, OTVLicenseDelegate { func contentIdentifier(url: URL) -> Data? {} func certificate() -> Data? {} func ckcMessage(spc: Data) -> Data? {} func scheme() -> String? {} }Instantiate an
OTVDRMManagerobject inOPYFPSSDKto do all the negotiation betweenOTVAVPlayerand your app (via theOTVLicenseDelegateimplementation).CODEprivate let drmManager = OTVDRMManager:sharedRegister the delegate to the
OTVDRMManager:CODEprivate let licenseDelegate = OTVDelegate() drmManager.setLicenseDelegate(licenseDelegate)Instantiate an
OTVAVPlayerusing either the content URL or anOTVAVPlayerItemobject and call itsinit()method:CODEprivate let player = OTVAVPlayer() player.init(item) /// or: private let player = OTVAVPlayer() player.init(url)
You should now be able to use the OTVAVPlayer object to playback FPS-encrypted content in the same way as with AVPlayer.