Source: https://developer.apple.com/forums/thread/822155 (April 2026; accepted response by Apple Media Engineer).
Status: Public API behavior confirmed by Apple; exact app-level transition still requires reproduction.
Real debugging question#
An iOS 18+ app first plays FairPlay HLS online using a non-persistable key, then downloads the same content for offline use. For the same content-key identifier, contentKeySession(_:didProvide:) is not invoked again. Calling processContentKeyRequest(withIdentifier:initializationData:options:) also does not force another callback.
Evidence and finding#
Tier 1 — Apple Media Engineer: AVContentKeySession caches valid keys by key ID; repeated requests do not reinvoke the delegate while the key remains valid. Apple says distinct IDs for online/offline are not required. Persistable-key creation requires requesting a persistable content-key request using respondByRequestingPersistableContentKeyRequestAndReturnError(), which leads to an AVPersistableContentKeyRequest callback. See the accepted answer at https://developer.apple.com/forums/thread/822155.
Tier 1 — API: https://developer.apple.com/documentation/avfoundation/avcontentkeyrequest documents key-request response APIs.
Interpretation: Missing repeated didProvide is not by itself a FairPlay KSM failure. It is consistent with session-level valid-key reuse. The public answer does not establish that calling the persistable conversion method on an already-completed original request is supported; test the transition lifecycle rather than assume retroactive conversion.
Dependency graph#
HLS EXT-X-KEY / SKD identifier
→ AVContentKeySession key-ID lookup
→ valid key already resolved? ──yes──> reuse key; no fresh didProvide
└──no──> AVContentKeyRequest callback
→ request persistable form (when eligible)
→ AVPersistableContentKeyRequest callback
→ authorized KSM exchange
→ persistable key data stored securely
→ offline playback
Hypotheses and falsification#
- Resolved-key cache suppresses callback (Apple-confirmed behavior). Test same identifier with a fresh controlled session and compare key request lifecycle. Do not assume session replacement is a recommended production workaround.
- Persistable conversion requested at wrong stage (unverified in reporter app). Instrument original request and conversion call timing; record return errors and persistable delegate callbacks.
- Identifier mismatch or normalization (unverified). Compare opaque hashed full SKD identifiers and exact manifest key references.
- KSM policy does not permit offline keys (unverified). Compare authorized KSM metadata and offline license policy without logging key material.
Client-only experiment#
On a test device, use an authorized asset and a single serial delegate queue. Log monotonic timestamps and anonymized key-ID hashes for initial request, key response, conversion request, persistable callback, KSM request, persisted-key creation and offline playback. Run online-first/offline-second versus offline-first flows with separate fresh test installations. Verify key-session association with assets and key recipients. Never expose SPC, CKC, keys, certificates or credentials.
Practical guidance#
Model online playback and offline key acquisition as distinct state-machine operations, not as 'call processContentKeyRequest again'. Request persistable keys at a documented, eligible point in the key lifecycle; do not rely on repeated didProvide for an already resolved ID. Verify exact API preconditions and return errors before shipping. Client-only by default; any KSM policy change is a separate proposal.
Reusable insight#
A cached valid FairPlay content key and a persistable content key are different lifecycle outcomes. A missing delegate callback for an already-resolved key is expected session behavior, not proof of a networking or DRM-server fault.
Evidence gaps#
No local reproduction, symbolicated AVFoundation traces, manifest bytes, or authorized KSM test was executed. Apple confirms the cache behavior and documented persistable-request path, but not the full root cause of the reporter's application integration.
Extended investigation prompt#
Show the full second-AI investigation prompt
Act as a senior iOS/tvOS reverse engineer and FairPlay DRM specialist. Investigate https://developer.apple.com/forums/thread/822155. Determine the first proven divergence in the online-to-offline content-key lifecycle. Apply a strict evidence hierarchy: (1) Apple Developer Documentation, FairPlay SDK, Apple Media Engineer statements, HLS specs; (2) pinned verified WebKit/open-source implementations, symbolicated AVFoundation/CoreMedia traces and verified security research, noting WebKit is not native AVPlayer; (3) reproducible device tests, byte-verified manifests and redacted KSM metadata; (4) explicitly labeled hypotheses. For each claim include exact URL, evidence tier, observation, counterevidence, confidence and falsification test. Analyze full EXT-X-KEY/SKD identities, key-session caching, processContentKeyRequest, didProvide, respondByRequestingPersistableContentKeyRequestAndReturnError, AVPersistableContentKeyRequest, authorized SPC/CKC handling and offline replay. Compare online-first/offline-second with offline-first, one variable at a time. Pin source commits and line numbers for source-level assertions. Never extract secrets or bypass DRM. Declare root cause only after reproduction, first divergence, intervention and falsification. Deliver a publication-ready report with client-only mitigation, separate KSM proposals and remaining unknowns.