Apple FairPlay integration
Integrate DRM-X 6.0 FairPlay Streaming on iOS, iPadOS, tvOS, and Safari using Swift, AVFoundation, SPC and CKC exchange, and secure server authorization.
Register FairPlay before integration#
Configure the FairPlay deployment and certificate material in DRM-X Console. Private key material remains encrypted and server-side. Publish an HLS/CBCS variant for the Content ID you plan to test.
Request the Apple session#
Send drmSystem: fairplay, manifestTypes: ["hls"], and the appropriate clientPlatform from your authenticated backend. The response provides the registered HLS manifest, certificate route, CKC license route, authorization instructions, and release route.
AVFoundation sequence#
- Load the certificate.Fetch it from the returned FairPlay certificate URL with the returned bounded authorization.
- Build content-key data.Use the
skd://identifier supplied by the HLS playlist and the application certificate. - Send the SPC.POST exact SPC bytes to the returned license URL and accept exact CKC bytes.
- Finish and release.Respond to the content-key request, then release the DRM-X session when viewing ends.
Safari and app acceptance#
- Test iPhone and iPad Safari with native HLS FairPlay.
- Test macOS Safari with qualified Shaka MSE FairPlay where available and native HLS fallback.
- Test native iOS, iPadOS, and tvOS playback, AirPlay policy, AV adapter policy, background transitions, renewal, and output changes.
- Use different Development and Production FairPlay deployments and credentials.
iOS, iPadOS, and tvOS with native FairPlay#
The Swift Package targets iOS and tvOS 15+. It uses AVFoundation’s resource loader for the FairPlay certificate, SPC, CKC, and session release flow.
import AVKit
import DrmXFairPlay
let controller = DrmXFairPlayPlayer()
let player = try await controller.prepare(
endpoint: URL(string: "https://customer.example/api/drmx/playback-session")!,
contentId: "course-12-lesson-4",
contentType: .vod,
customerHeaders: ["Authorization": "Bearer \(customerAccessToken)"]
)
playerViewController.player = player
player.play()
Your backend selects the policy template. Do not put a policy, manifest URL, Site Key, Access Key, or long-lived token in the app bundle. Test real HLS/CBCS media on physical iPhone, iPad, and Apple TV devices, including HDMI and AirPlay decisions.
DRM-X 6.0