DRM-X 6.0 dove and olive branch logoDRM-X 6.0Docs

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.

View MarkdownLive examples ↗Updated 2026-09-05
Certificate → SPC challenge → CKC response → native playback. Keep binary challenge and response bytes unchanged.
Certificate → SPC challenge → CKC response → native playback. Keep binary challenge and response bytes unchanged.

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.

Preserve native bytesDo not base64-transform, JSON-wrap, or reinterpret SPC and CKC data unless the returned contract explicitly requires it. Proxy the exact binary request and response types.

AVFoundation sequence#

  1. Load the certificate.Fetch it from the returned FairPlay certificate URL with the returned bounded authorization.
  2. Build content-key data.Use the skd:// identifier supplied by the HLS playlist and the application certificate.
  3. Send the SPC.POST exact SPC bytes to the returned license URL and accept exact CKC bytes.
  4. 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.
Apple SDK

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.