Enabling playback of FPS encrypted content
To enable FairPlay Streaming in your app:
Create a new Xcode project and then implement the
OTVLicenseDelegate
protocol 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
OTVDRMManager
object inOPYFPSSDK
to do all the negotiation betweenOTVAVPlayer
and your app (via theOTVLicenseDelegate
implementation).CODEprivate let drmManager = OTVDRMManager:shared
Register the delegate to the
OTVDRMManager
:CODEprivate let licenseDelegate = OTVDelegate() drmManager.setLicenseDelegate(licenseDelegate)
Instantiate an
OTVAVPlayer
using either the content URL or anOTVAVPlayerItem
object 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
.