Source#
Apple Developer Forums: https://developer.apple.com/forums/thread/786659
Resolution updated: 2026-09-10
Problem#
A FairPlay-protected HLS asset is downloaded as a local .movpkg. asset.assetCache.isPlayableOffline == true, but the first offline call to:
try await asset.load(.variants)can intermittently fail with NSURLErrorDomain -1009 and:
AVErrorFailedDependenciesKey = (
"assetProperty_HLSAlternates"
)
The outer error reports the local .movpkg URL. Recreating the asset/player may then succeed under the same offline conditions.
Resolution status#
Confirmed mechanism; field trigger still unresolved.
The confirmed mechanism is that load(.variants) requests CoreMedia's HLSAlternates property. For a downloaded HLS package, that property is normally built from the package's local master-playlist mapping. If the local master DataItem cannot be used, the streaming resolver falls back to the original master URL retained in the package metadata.
When that fallback occurs offline, the request fails with -1009 (-1004 when the interface is up but the origin is unreachable).
The remaining unresolved question is why an apparently intact field .movpkg can transiently fail to expose/use its local master mapping on the first attempt.
Key distinction#
assetCache.isPlayableOffline == true
≠
complete HLS variant graph is guaranteed to resolve locally
isPlayableOffline asks whether at least one locally cached presentation can play offline. .variants is a broader metadata operation that materializes the HLS alternate/variant graph.
Therefore this failure is a metadata-resolution failure, not proof that the downloaded presentation is unplayable.
Confirmed execution path#
AVURLAsset.load(.variants)
→ request HLSAlternates
→ initialize streaming property loader
→ translate local .movpkg
→ resolve boot.xml Master DataItem
→ resolve local master-playlist DataPath
→ parse multivariant playlist
→ obtain alternate array
The failure branch is:
local Master DataItem unavailable/unreadable
→ local multivariant state cannot satisfy HLSAlternates
→ resolver follows retained MasterPlaylist.NetworkURL
→ real HTTP GET to original master URL
→ network unavailable
→ NSURLErrorDomain -1009 / -1004
→ HLSAlternates marked failed
→ load(.variants) throws
Evidence#
Public contract#
AVAssetCache.isPlayableOfflinedoes not guarantee that all associated media-selection options or all higher-level asset metadata are available offline.AVAssetVariantrepresents variants derived from HLS multivariant playlist state.
Healthy downloaded package#
Using Apple's public BipBop HLS sample:
- online master exposed 24 variants;
AVAssetDownloadURLSessionproduced a completed.movpkg;- the package reported
isPlayableOffline == true; boot.xmlmappedDataItem(Role=Master)to a local master playlist under the packageDatadirectory;- that local master still contained all 24 variant declarations even though only a subset of streams was downloaded;
- with network denied,
.variantsstill returned all 24 variants and direct playback succeeded.
This proves a healthy package can satisfy HLSAlternates entirely from local master metadata.
Fault-injection control#
A controlled localhost HLS origin was used with a downloaded .movpkg.
Results:
intact package + origin down
→ .variants resolves locally
→ 0 failures in 200 fresh-process attempts
→ 0 origin requests
Master DataItem removed + origin down
→ HLSAlternates fails
→ NSURLErrorDomain -1004
→ outer failing URL is local .movpkg
Master DataItem zero-byte + origin down
→ same failure
same broken package + origin up
→ .variants succeeds
→ exactly one GET /master.m3u8 observed per load
This proves the remote-fallback edge is a real network request, not a synthesized offline error.
Why the error shows the .movpkg URL#
The outer AVFoundation error identifies the asset whose property failed:
NSErrorFailingURLKey
→ local .movpkg creation URL
AVErrorFailedDependenciesKey
→ HLSAlternates
That does not mean the nested resolver requested the .movpkg over the network. The actual remote resource must be established from the underlying error chain or CoreMedia/CFNetwork/network trace.
FairPlay relationship#
FairPlay is correlated with the reported assets but is not a direct prerequisite of HLSAlternates.
The relevant paths are separate:
variant metadata:
.movpkg → master playlist → HLSAlternates → AVAssetVariant
content protection:
content-key specifier → AVContentKeySession → persisted key → decrypt → render
Unless a content-key callback precedes and blocks the HLSAlternates failure, do not classify this as a FairPlay license/key failure.
Field trigger — unresolved#
The controlled tests explain exactly what happens when local master state is unavailable, but they do not yet explain why the original intact field package transiently enters that branch on the first attempt.
Still-open hypotheses:
- transient download-cache translator / playlist-state publication race;
- terminal per-
AVURLAssetasync-property state combined with a transient condition; - shared MediaToolbox/CoreMedia state becoming ready between attempts;
- the reported retry actually bypasses
.variantsand goes directly to player preparation; - package/file coordination temporarily makes the master mapping unavailable.
Do not describe retry success as cache warming until a concrete state/cache object is identified before and after the failed attempt and the retry is shown consuming that exact state.
Client fix#
Remove .variants from the offline playback critical path.
let asset = AVURLAsset(url: packageURL)
guard asset.assetCache?.isPlayableOffline == true else {
throw OfflinePlaybackError.packageNotPlayable
}
// Configure persisted FairPlay-key handling independently.
// Do not gate playback on asset.load(.variants).
player.replaceCurrentItem(with: AVPlayerItem(asset: asset))For offline audio/subtitle choices, use the locally cached media-selection options exposed by AVAssetCache.
If product logic needs bitrate/codec/variant descriptors while offline, persist the required descriptors when the download is configured/completed. Treat a later .variants request as optional inspection rather than a playback prerequisite.
A bounded asset recreation may be a pragmatic workaround for a transient OS issue, but it is not a root-cause fix.
Minimal verification for the remaining field trigger#
Run the same immutable package under identical conditions:
A. asset A → load(.variants) → retry load(.variants) on asset A
B. asset C → load(.variants) → new asset D → load(.variants)
C. asset E → AVPlayerItem directly, without .variants
Capture:
process/run UUID
monotonic timestamp
AVURLAsset object identity
package path/file identity
isPlayableOffline
property status before/after
full NSError + NSUnderlyingError chain
actual consulted resource URL
AVPlayerItem readiness
AVContentKeySession callback timestamps
CoreMedia / AVFoundation / CFNetwork events
The target is the first state difference that makes the intact local Master DataItem unavailable on attempt 1 and available/bypassed on attempt 2.
Engineering rule#
Offline playable does not mean offline introspectable.
For downloaded HLS, keep these contracts separate:
local presentation playable
≠
all media selections cached
≠
complete multivariant graph locally resolvable
≠
all optional AVURLAsset properties network-independent
References#
- Apple Developer Forums: https://developer.apple.com/forums/thread/786659
AVAssetCache: https://developer.apple.com/documentation/avfoundation/avassetcache- AVAsset variants: https://developer.apple.com/documentation/avfoundation/avpartialasyncproperty/variants
AVAssetDownloadURLSession: https://developer.apple.com/documentation/avfoundation/avassetdownloadurlsession
Follow-up investigation — 19 November 2026#
The earlier fault-injection results above establish a fallback mechanism as reported in this repository, not the cause of the transient field incident. Raw experiment artifacts were not independently inspected in this follow-up.
To distinguish a per-asset failure from shared initialization or a bypassed metadata operation, use the following randomized trial arms with an immutable authorized test package:
| Arm | First operation | Next operation |
|---|---|---|
| A | Load variants | Retry on same asset |
| B | Load variants | Retry on fresh asset |
| C | Prepare player item directly | Load variants after readiness |
| D | Load variants after controlled delay | Retry on fresh asset |
Use a fresh process for each first-attempt trial; retain process identity and exact operation order. Record first-frame success independently from property-load success. Compare clear and protected assets separately, and record whether a real origin or KSM transaction occurred. Preserve a healthy package control and use the prior damaged-package test only as a lab positive control, never as a production workaround.
At a hypothetical independent 8% failure probability, 36 first-attempt trials give approximately 95% probability of seeing at least one failure. This is a planning calculation, not measured reproduction. With zero failures in 200 independent trials, the one-sided 95% upper bound is approximately 1.49%; clustered failures or shared state invalidate the independence assumption.
Log the actual resource consulted, complete error chain, property-load start/end, package file identity, download completion, process and asset identities, key callback timing, and first rendered frame. Use CoreMedia HLS diagnostics and sysdiagnose; distinguish confirmed HTTP requests from inferred network dependency. Keep optional variant enumeration out of the offline playback critical path where product requirements permit.
Extended investigation prompt
Act as a senior iOS reverse engineer, AVFoundation/CoreMedia investigator and FairPlay DRM specialist.
Case: https://developer.apple.com/forums/thread/786659
Prior investigation: #13
Find the first causal divergence in first-attempt offline HLS variant loading. Distinguish the previously reported remote fallback mechanism from the still-unresolved transient field trigger.
Evidence hierarchy: (1) official Apple documentation, Apple engineering statements, FairPlay SDK and HLS specifications; (2) verified version-pinned WebKit or other relevant source, symbolicated AVFoundation/CoreMedia traces and vetted security research; (3) reproducible physical-device experiments, package metadata and sanitized network traces; (4) explicitly falsifiable hypotheses. WebKit is not native AVPlayer source. Cite exact URLs, OS builds, commit SHA, file, function and line range where applicable. Do not invent private symbols or evidence.
Trace download completion, local master mapping, variant property resolution, any original-master HTTP fallback, content key callbacks and first-frame rendering. Compare same-asset retry, fresh-asset retry, direct playback and delayed loading in randomized fresh-process trials. Audit the prior raw artifacts before treating their results as independently verified. Use authorized media only; never expose keys, SPC/CKC payloads or credentials, or bypass DRM.
Require reproducible failure, first demonstrated divergence, controlled reversal and falsification of alternatives before declaring the field root cause. Otherwise report it as unverified. Deliver an evidence ledger, synchronized event timeline, test matrix, statistical limits, client-only mitigation, separate server proposals and publication-ready article.