FairPlay iOS SDK Guide
DoveRunner FairPlay iOS SDK makes it easy to apply Apple’s FairPlay Streaming DRM when developing media service apps for iOS. This document describes how to use the libraries and sample projects included in the SDK.
Details of DoveRunner Multi DRM service integration are provided in License Token Guide. For technical questions about using the SDK, please visit our Helpdesk site.
Supported Environments
Section titled “Supported Environments”- iOS 13.5+
Prerequisites
Section titled “Prerequisites”To apply FairPlay Streaming DRM, content service site should follow the below steps before starting integration.
- Enroll in Apple developer program ( https://developer.apple.com/support/enrollment/ )
- Request
FPS Deployment Packageto Apple ( https://developer.apple.com/streaming/fps/ ) - Using the
deployment package, create the below four items and register them onIntegration Settingspage of DoveRunner Console site.
- FPS certificate file (.der or .cer)- Private key file (.pem)- Password for the private key (string)- Application secret key (ASK) stringNOTE:
Please refer to the FairPlay Cert Registration Tutorial for details on the above registration process.
Tutorial Video
Section titled “Tutorial Video”This video is a tutorial for playing DRM content in an iOS app using the FPS SDK.
For optimal playback, select ‘1080p’ as the video quality and enable subtitle (Korean or English) before starting playback.
Configuring your project
Section titled “Configuring your project”You can add DoveRunner FPS SDK by following steps:
- Download the
DoveRunnerFairPlay.xcframeworkfile from github. - Add the
PallyConFPSSDK.xcframeworklibrary provided in thelibfolder to your project.
- Add the framework’s path to
Linked Frameworks and Librariessetting in XcodeGeneraltab. - Add the framework’s path to
Framework Search Pathssetting in XcodeBuild Settingstab.
- GoogleCast Framework is required to build ‘Advanced Sample’.
- Use COCOAPODS to install GoogleCast.framework (pod install), and execute the created
PallyConFPSAdvanced.xcworkspace.
Quick Start
Section titled “Quick Start”The following code shows how to stream or download FPS HLS content using DoveRunnerFairPlay SDK.
Streaming FPS content
Section titled “Streaming FPS content”// 1. Initialize the DoveRunnerFairPlay SDK.let doverunnerSdk = DoveRunnerFairPlay()
let urlAsset = AVURLAsset(url: "Content Url(m3u8)")let config = FairPlayConfiguration(avURLAsset: urlAsset, contentId: "ContentID", certificateUrl: "Certification URL", authData: "Token or CustomData")
// 2. Before playing FPS content, prepare to acquire a license by setting token information.doverunnerSdk.prepare(drm: config)Downloading FPS content
Section titled “Downloading FPS content”// 1. Create DoveRunnerFairPlay instance.let doverunnerSdk = DoveRunnerFairPlay()
let urlAsset = AVURLAsset(url: "Content Url(m3u8)")let config = FairPlayConfiguration(avURLAsset: urlAsset, contentId: "ContentID", certificateUrl: "Certification URL", authData: "Token or CustomData")
// 2. To download FPS content, create a DownloadTask object and enter token information to prepare for license acquisition.let downloadTask = doverunnerSdk.createDownloadTask(drm: config, downloadDelegate:"FairPlayDownloadDelegate")
// 3. Start downloading content// If the content download was canceled previously, it will be resumed.downloadTask.resume()
// 4. Cancel download (if needed)downloadTask.cancel()Create CustomData for Chromecast playback
Section titled “Create CustomData for Chromecast playback”// DoveRunnerFairPlay SDK supports Chromecast.// Get CustomData needed to create 'GCKMediaInformation' object when using Chromecast SDK// CustomData should be created by DoveRunnerFairPlay instance.let jsonData = doverunnerSdk.getJsonforChromecastPlayback(authData: "Token or CustomData")API References
Section titled “API References”For descriptions of all the APIs provided by DoveRunner FPS iOS SDK, see the API reference documentation included in the SDK file.